Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix time zone being ignored on Android #4809

Merged
merged 2 commits into from
Jun 27, 2023

Conversation

MarkusPettersson98
Copy link
Contributor

@MarkusPettersson98 MarkusPettersson98 commented Jun 21, 2023

Fix time zone being ignored on Android, incorrectly outputting UTC timestamps. A fix is included in chrono >= 4.25.

This issue is recognized in chrono's issue tracker: chronotope/chrono#922, and the fix seems to be to extract timezone info from a tzdata file.


This change is Reviewable

@linear
Copy link

linear bot commented Jun 21, 2023

DES-235 The time zone is ignored on Android

We use chrono::Local::now() for timestamps when logging. This incorrectly outputs UTC timestamps on Android.

Slack discussion: https://mullvad.slack.com/archives/C33N9MLQ7/p1686144914485789

@MarkusPettersson98 MarkusPettersson98 changed the title Upgrade chrono to 0.4.26 Fix time zone being ignored on Android Jun 21, 2023
Copy link
Contributor

@Pururun Pururun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 6 of 6 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@MarkusPettersson98 MarkusPettersson98 marked this pull request as draft June 21, 2023 12:58
@MarkusPettersson98 MarkusPettersson98 force-pushed the the-time-zone-is-ignored-on-android-des-235 branch 2 times, most recently from 8aca744 to 32fe78d Compare June 21, 2023 13:21
@MarkusPettersson98 MarkusPettersson98 marked this pull request as ready for review June 21, 2023 13:33
Copy link
Collaborator

@pinkisemils pinkisemils left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: Should I sign the relevant commits and merge them?

Reviewed 6 of 6 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@MarkusPettersson98 MarkusPettersson98 force-pushed the the-time-zone-is-ignored-on-android-des-235 branch from 32fe78d to 8d90bb5 Compare June 27, 2023 10:57
Copy link
Contributor Author

@MarkusPettersson98 MarkusPettersson98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to do so 😊

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@MarkusPettersson98 MarkusPettersson98 force-pushed the the-time-zone-is-ignored-on-android-des-235 branch from 8d90bb5 to f7d84a7 Compare June 27, 2023 13:33
Fix time zone being ignored on Android, incorrectly outputting UTC
timestamps. This more recent version of `chrono` extracts timezone info
from a tzdata file on Android.

This issue is recognized in `chrono`'s issue tracker:
chronotope/chrono#922
Since `chrono 0.4.23`, the use of
`chrono::NaiveDateTime::from_timestamp` is deprecated in favor of
`chrono::NaiveDateTime::from_timestamp_opt`, which returns an `Option`
instead of panicking if number of seconds is out of range.
@pinkisemils pinkisemils force-pushed the the-time-zone-is-ignored-on-android-des-235 branch from f7d84a7 to 7747e2e Compare June 27, 2023 14:02
@pinkisemils pinkisemils merged commit 8516b96 into main Jun 27, 2023
29 checks passed
@pinkisemils pinkisemils deleted the the-time-zone-is-ignored-on-android-des-235 branch June 27, 2023 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants