Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

tzdb.cpp: Fall back to numeric offset when the current code page cannot represent the time zone short ID#5558

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
StephanTLavavej merged 3 commits intomicrosoft:mainfromcpplearner:patch-1
Jun 14, 2025

Conversation

@cpplearner
Copy link
Contributor

@cpplearnercpplearner commentedMay 31, 2025
edited
Loading

This PR adds a fallback time zone abbreviation of the form-05 or+0530 when the system's code page cannot represent the localized time zone short ID produced by ICU. Previously such time zone short ID would result inERROR_NO_UNICODE_TRANSLATION exceptions.

The numeric offset form (-05 or+0530) is chosen because it is similar to the time zone abbreviation intzdb, and distinguishable from ICU's output.

The behavior depends on the current user locale and the current code page. ForICU 77.1, the following locales have time zone short ID with non-ASCII characters, and thus might be affected by this fallback:am,ar,as,bg,blo,brx,ckb,cs,dz,fa,ff_Adlm,ga,gd,he,hi,ii,km,ks,ks_Deva,ku,mai,ml,mni,nqo,sa,sat,sd,sd_Deva,si,sk,vi,xnr. In addition, the following locales have non-ASCII character (U+2212 or U+2013) as the minus sign, and thus are also affected:et,eu,fa,fr,lij,lt,se,sv.

No tests are added because theen locale is unaffected.

Fixes#3158
Fixes#5482

@cpplearnercpplearner requested a review froma team as acode ownerMay 31, 2025 07:04
@StephanTLavavejStephanTLavavej added bugSomething isn't working chronoC++20 chrono labelsJun 1, 2025
@StephanTLavavejStephanTLavavej self-assigned thisJun 1, 2025
@StephanTLavavej
Copy link
Member

Thanks! 😻 I adjusted the code slightly, then manually verified that it still correctly prints both minutes and whole hours (by brain-surgery nulling out the abbrev pointer in the debugger).

@StephanTLavavejStephanTLavavej removed their assignmentJun 3, 2025
@StephanTLavavejStephanTLavavej moved this fromInitial Review toReady To Merge inSTL Code ReviewsJun 3, 2025
@StephanTLavavejStephanTLavavej moved this fromReady To Merge toMerging inSTL Code ReviewsJun 11, 2025
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavejStephanTLavavej merged commit029ce56 intomicrosoft:mainJun 14, 2025
48 checks passed
@github-project-automationgithub-project-automationbot moved this fromMerging toDone inSTL Code ReviewsJun 14, 2025
@StephanTLavavej
Copy link
Member

Thanks for figuring out how to fix this in a reasonable way! 😻 🗺️ 🕥

@cpplearnercpplearner deleted the patch-1 branchJune 14, 2025 13:46
}

_Info->_Err = __std_tzdb_error::_Success;
_Info->_Abbrev = _Fallback_abbrev.release();
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for commenting after a merge, but does thisrelease() call means we are leaking memory?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

We aren't leaking memory. The returned__std_tzdb_sys_info* will be stored in aunique_ptr<__std_tzdb_sys_info, _Tzdb_deleter<__std_tzdb_sys_info>>, which will call__std_tzdb_delete_sys_info in its destructor, which will performdelete[] _Info->_Abbrev;

frederick-vs-ja reacted with thumbs up emoji
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@StephanTLavavejStephanTLavavejStephanTLavavej approved these changes

+1 more reviewer

@TheStormNTheStormNTheStormN left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

bugSomething isn't workingchronoC++20 chrono

Projects

Archived in project

Milestone

No milestone

3 participants

@cpplearner@StephanTLavavej@TheStormN

[8]ページ先頭

©2009-2025 Movatter.jp