<xloctime>: Fix time_get::do_get format strings for %c and %x#6133
Open
BrandonPacewic wants to merge 4 commits intomicrosoft:mainfrom
Open
<xloctime>: Fix time_get::do_get format strings for %c and %x#6133BrandonPacewic wants to merge 4 commits intomicrosoft:mainfrom
<xloctime>: Fix time_get::do_get format strings for %c and %x#6133BrandonPacewic wants to merge 4 commits intomicrosoft:mainfrom
Conversation
93d08fd to
3d43595
Compare
cpplearner
reviewed
Mar 4, 2026
|
|
||
| case 'x': | ||
| _First = _Getfmt(_First, _Last, _Iosbase, _State, _Pt, "%d / %m / %y"); | ||
| _First = _Getfmt(_First, _Last, _Iosbase, _State, _Pt, "%m/%d/%y"); |
Contributor
There was a problem hiding this comment.
Similar specifiers, like %D and %T, continue to allow whitespace. This is consistent with the POSIX spec up to 2018, although I note that the 2024 version removes the whitespace. For consistency, I think it's better to keep it here.
Contributor
Author
There was a problem hiding this comment.
Just to confirm, current implementation correct?
Contributor
There was a problem hiding this comment.
Sorry, I'm not sure what you're asking.
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. 🙃