Skip to content

[WIP] Add tzset using ICU and tests. #6048

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jellefoks
Copy link
Member

@jellefoks jellefoks commented Jun 9, 2025

This adds tzset(). This POSIX functions sets the values of the tzname,
timezone, and daylight globals from the TZ environment variable.

This is implemented using our ICU's tzdata with fallback to POSIX
compliant parsing where ICU is unable to recognize the format of the TZ
variable.

Some corrections are done for certain IANA timezones, necessary since our
tzdata is currently version 2023c.

A helper function is added for parsing the POSIX format for the TZ value.

ICU is initialized early with a global static bool. That way it is
always initialized, even without using //base.

Also add extensive tests. Many tests are excluded for non-hermetic
builds because they set incorrect values.

Bug: 406082846

@jellefoks jellefoks changed the title Add tzset using ICU and tests. [WIP] Add tzset using ICU and tests. Jun 9, 2025
@jellefoks
Copy link
Member Author

jellefoks commented Jun 9, 2025

This builds on #5903. Only the last commit (currently 9cdfb0d ) has new code that isn't in #5903.

@jellefoks jellefoks force-pushed the add_timezone_tzset_and_tests branch 5 times, most recently from 2455ee5 to a0754e3 Compare June 9, 2025 22:54
@jellefoks jellefoks force-pushed the add_timezone_tzset_and_tests branch 2 times, most recently from a28d492 to 7440dd7 Compare June 9, 2025 23:50
@jellefoks jellefoks force-pushed the add_timezone_tzset_and_tests branch 3 times, most recently from e8c09a9 to 8460dca Compare June 13, 2025 20:51
This adds tzset(). This POSIX functions sets the values of the tzname,
timezone, and daylight globals from the TZ environment variable.

This is implemented using our ICU's tzdata with fallback to POSIX
compliant parsing where ICU is unable to recognize the format of the TZ
variable.

Some corrections are done for certain timezones, necessary since our
tzdata is version 2023c.

A helper function is added for parsing the POSIX format for the TZ value.

ICU is initialized early with a global static bool, so that it is
initialized even without using //base.

Also add extensive tests. Many tests are excluded for non-hermetic
builds because they set incorrect values.

Bug: 406082846
@jellefoks jellefoks force-pushed the add_timezone_tzset_and_tests branch from 8460dca to 8bc6d45 Compare June 13, 2025 20:59
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.

1 participant