Skip to content

Support POSIX TZ strings in TZif databases #15863

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

HertzDevil
Copy link
Contributor

Follow-up to #15792.

@straight-shoota straight-shoota added this to the 1.17.0 milestone Jun 1, 2025
@HertzDevil
Copy link
Contributor Author

macOS CI is breaking because it explicitly sets $TZ to America/New_York, which means Time.local(9999, 12, 31, 23, 59, 59, nanosecond: 999_999_999) would return a UTC instant in the year 10000. It was originally introduced in #2682 for a spec of what is now HTTP.format_time, but that spec currently uses a fixed time zone and does not depend on $TZ anymore.

I propose unsetting $TZ in bin/ci.

@straight-shoota
Copy link
Member

straight-shoota commented Jun 2, 2025

Hm, I don't know. In general, it might not be a bad idea to set an explicit time zone other than UTC. Precisely to find problems with time zone expectations.

Why is this spec suddenly broken? Why is it impossible to have a Time instance for that instant in America/New_York?

@HertzDevil
Copy link
Contributor Author

Never mind, this is where the exception is actually raised:

crystal/src/time/tz.cr

Lines 112 to 114 in 96bf61e

local_new_year = Time.utc(local_year, 1, 1).to_unix + (new_year_is_dst ? dst_offset : std_offset)
local_new_year_next = Time.utc(local_year + 1, 1, 1).to_unix + (new_year_is_dst ? dst_offset : std_offset)
break if local_new_year <= unix_seconds < local_new_year_next

@straight-shoota straight-shoota removed this from the 1.17.0 milestone Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants