<xloctime>: Fix time_get::do_get format strings for %c and %x - #6133
Merged
Stephan T. Lavavej (StephanTLavavej) merged 8 commits intoMar 24, 2026
Conversation
Brandon Pacewic (BrandonPacewic)
force-pushed
the
xloctime-time-get-do-get-format
branch
from
March 3, 2026 03:49
93d08fd to
3d43595
Compare
Brandon Pacewic (BrandonPacewic)
requested a review
from Matt Stephanson (MattStephanson)
March 13, 2026 01:52
Matt Stephanson (MattStephanson)
approved these changes
Mar 13, 2026
Stephan T. Lavavej (StephanTLavavej)
approved these changes
Mar 18, 2026
Member
|
Thanks! 😻 I pushed a test change as recommended by Matt Stephanson (@MattStephanson). |
S. B. Tam (cpplearner)
approved these changes
Mar 19, 2026
S. B. Tam (cpplearner)
left a comment
Contributor
There was a problem hiding this comment.
This fixes time_get so that it can parse the output of strftime in the "C" locale, which is an improvement.
The format still doesn't match strftime when the locale is not "C", but I think we shouldn't support that scenario. I filed LWG-4541 in the hope that we can get an explicit permission to do whatever we want with locale-dependent specifiers like %c or %x.
Member
|
I'm mirroring this to the MSVC-internal repo. Please notify me if any further changes are pushed, otherwise no action is required. |
Stephan T. Lavavej (StephanTLavavej)
added a commit
to StephanTLavavej/STL
that referenced
this pull request
Mar 21, 2026
Stephan T. Lavavej (StephanTLavavej)
added a commit
to StephanTLavavej/STL
that referenced
this pull request
Mar 21, 2026
Stephan T. Lavavej (StephanTLavavej)
merged commit Mar 24, 2026
09cc7d6
into
microsoft:main
49 checks passed
Member
|
Thanks for fixing this bug! ⏱️ 🗺️ 🌏 |
Stephan T. Lavavej (StephanTLavavej)
added a commit
to mirion-dev/STL
that referenced
this pull request
Mar 24, 2026
Brandon Pacewic (BrandonPacewic)
deleted the
xloctime-time-get-do-get-format
branch
March 29, 2026 06:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6129.
time_get::do_gethardcoded the wrong format strings for%cand%xin the C locale:%cwas"%b %d %H : %M : %S %Y", missing the leading weekday field entirely. It should be"%a %b %e %T %Y"to match whatstrftime("%c")produces.%xwas"%d / %m / %y"(day/month order), but should be"%m/%d/%y"(month/day order) to matchstrftime("%x").As the original open issue describes, this is an ABI preserving behavior change. The existing test
Dev11_0836436_get_timeis updated accordingly and its%xtest inputs were written for the old day first format and its comment cited"%d / %m / %y"directly.The libcxx test
std/localization/locale.categories/category.time/locale.time.get/locale.time.get.members/get_one.pass.cppstill fails due to a separate pre-existing bug wheredo_getdoes not handle the%%specifier (falls todefault: failbit) (#6130). Its entry inexpected_results.txtis left in place.Also updates
P0355R7_calendars_and_time_zones_iotest inputs for%cand%x, sincestd::chrono::parseroutes those format specifiers throughtime_get::do_getand the existing inputs were written against the old incorrect format strings.Force push note 🐱
I force pushed during early preparation of this PR to fix a commit message and add a missing `test.lst` entry before any review had begun. I understand that force pushing during active review is disruptive and I will not do so going forward. 🙃