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

Explore time zone lookup errors #1454

Closed
wants to merge 3 commits into from

Conversation

pitdicker
Copy link
Collaborator

@pitdicker pitdicker commented Feb 22, 2024

To have something to talk about for #1448.

The Windows code is pretty clean and has OsError and InvalidTimeZoneData as error causes.

The Unix code remains in dire need of a refactoring.
I've tried to hook it up reasonably well to the error causes InvalidTzString, TimeZoneUnknown, TimeZoneNotFound, and InvalidTimeZoneData. NoTzdb isn't hooked up yet.

@pitdicker
Copy link
Collaborator Author

The Unix code remains in dire need of a refactoring.

I did a rewrite in #1457. As it turns out the caching logic was pretty much broken beyond the most basic cases.

What I have come to see more clearly related to this PR: we have three fallbacks. Any error is just swallowed and the next fallback is tried. The last fallback is to use the UTC time zone.

That we try multiple methods to determine the time zone is only logical.
However if we determine the time zone, but its configuration turns out to be broken, I am not sure it is good to continue trying other fallbacks.
Silently falling back to UTC while the user expects a local time doesn't seem great to me. We are not limited to fitting everything in an infallible API no matter what, like libc. We already return Options or LocalResults.

I'll open an issue to discuss for 0.5.

@pitdicker pitdicker mentioned this pull request Feb 24, 2024
@djc
Copy link
Contributor

djc commented Feb 27, 2024

Silently falling back to UTC while the user expects a local time doesn't seem great to me. We are not limited to fitting everything in an infallible API no matter what, like libc. We already return Options or LocalResults.

Agreed. IIRC we tried this in the beginning but it was too big of a backwards compatibility issue. Would like to address this in 0.5.

@pitdicker pitdicker closed this Mar 11, 2024
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

2 participants