fix: improper use of ucal_inDaylightTime by daksh-goyal · Pull Request #6097 · microsoft/STL · GitHub
Skip to content

fix: improper use of ucal_inDaylightTime#6097

Merged
StephanTLavavej merged 4 commits into
microsoft:mainfrom
daksh-goyal:tzdb-dst-fix
Feb 24, 2026
Merged

fix: improper use of ucal_inDaylightTime#6097
StephanTLavavej merged 4 commits into
microsoft:mainfrom
daksh-goyal:tzdb-dst-fix

Conversation

@daksh-goyal

@daksh-goyal daksh-goyal commented Feb 21, 2026

Copy link
Copy Markdown
Contributor

ucal_inDaylightTime is used to check whether the timezone is currently observing DST. STL (likely in an attempt to be defensive) tries to use it as a way to tell whether the timezone observed DST on the date in question (which could be in the past), which is wrong.

Fixing that by omitting use of that guard before obtaining DST offset.

fixes: #6096

`ucal_inDaylightTime` is used to check whether the timezone is currently observing DST. STL (likely in an attempt to be defensive) tries to use it as a way to tell whether the timezone observed DST on the date in question (which could be in the past), which is wrong.
@daksh-goyal daksh-goyal requested a review from a team as a code owner February 21, 2026 23:58
@github-project-automation github-project-automation Bot moved this to Initial Review in STL Code Reviews Feb 21, 2026
@StephanTLavavej StephanTLavavej added bug Something isn't working chrono C++20 chrono labels Feb 22, 2026
Comment thread stl/src/tzdb.cpp Outdated
Comment thread stl/src/tzdb.cpp Outdated
@github-project-automation github-project-automation Bot moved this from Initial Review to Work In Progress in STL Code Reviews Feb 22, 2026
Comment thread stl/src/tzdb.cpp Outdated
@daksh-goyal

Copy link
Copy Markdown
Contributor Author

Added regression tests for timezones that abolished DST to ensure correct historical offsets.
@StephanTLavavej

Copy link
Copy Markdown
Member

Thanks! I've manually verified that the regression test produced all wrong answers before the fix.

@StephanTLavavej StephanTLavavej moved this from Work In Progress to Ready To Merge in STL Code Reviews Feb 22, 2026
@StephanTLavavej StephanTLavavej moved this from Ready To Merge to Merging in STL Code Reviews Feb 23, 2026
@StephanTLavavej

Copy link
Copy Markdown
Member

I'm mirroring this to the MSVC-internal repo. Please notify me if any further changes are pushed, otherwise no action is required.

@StephanTLavavej StephanTLavavej merged commit 5c9d98c into microsoft:main Feb 24, 2026
45 checks passed
@github-project-automation github-project-automation Bot moved this from Merging to Done in STL Code Reviews Feb 24, 2026
@StephanTLavavej

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working chrono C++20 chrono

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<chrono>: Incorrect time conversion for zones where DST was observed in the past

2 participants