From 3d43595dbe577bf862ff72da7770b091ddf123d8 Mon Sep 17 00:00:00 2001 From: BrandonPacewic <92102436+BrandonPacewic@users.noreply.github.com> Date: Mon, 2 Mar 2026 19:14:18 -0800 Subject: [PATCH 1/6] bug: fix `time_get::do_get` format strings for `%c` and `%x` --- stl/inc/xloctime | 4 +- tests/std/test.lst | 1 + .../std/tests/Dev11_0836436_get_time/test.cpp | 9 ++-- .../GH_6129_time_get_do_get_format/env.lst | 4 ++ .../GH_6129_time_get_do_get_format/test.cpp | 50 +++++++++++++++++++ 5 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 tests/std/tests/GH_6129_time_get_do_get_format/env.lst create mode 100644 tests/std/tests/GH_6129_time_get_do_get_format/test.cpp diff --git a/stl/inc/xloctime b/stl/inc/xloctime index 15036ae8d77..bc9db01828f 100644 --- a/stl/inc/xloctime +++ b/stl/inc/xloctime @@ -453,7 +453,7 @@ protected: break; case 'c': - _First = _Getfmt(_First, _Last, _Iosbase, _State, _Pt, "%b %d %H : %M : %S %Y"); + _First = _Getfmt(_First, _Last, _Iosbase, _State, _Pt, "%a %b %e %T %Y"); break; case 'C': @@ -547,7 +547,7 @@ protected: break; case 'x': - _First = _Getfmt(_First, _Last, _Iosbase, _State, _Pt, "%d / %m / %y"); + _First = _Getfmt(_First, _Last, _Iosbase, _State, _Pt, "%m/%d/%y"); break; case 'y': diff --git a/tests/std/test.lst b/tests/std/test.lst index 2751839bf3d..e7f3754d164 100644 --- a/tests/std/test.lst +++ b/tests/std/test.lst @@ -280,6 +280,7 @@ tests\GH_005768_pow_accuracy tests\GH_005780_non_ascii_locales tests\GH_005800_stable_sort_large_alignment tests\GH_005968_headers_provide_begin_end +tests\GH_6129_time_get_do_get_format tests\LWG2381_num_get_floating_point tests\LWG2510_tag_classes tests\LWG2597_complex_branch_cut diff --git a/tests/std/tests/Dev11_0836436_get_time/test.cpp b/tests/std/tests/Dev11_0836436_get_time/test.cpp index ff7a8be5b97..78f44a827e6 100644 --- a/tests/std/tests/Dev11_0836436_get_time/test.cpp +++ b/tests/std/tests/Dev11_0836436_get_time/test.cpp @@ -20,6 +20,7 @@ using namespace std; // DevDiv-836436 ": get_time()'s AM/PM parsing is broken" // DevDiv-872926 ": time_get::get parsing format string gets tm::tm_hour wrong [libcxx]" // VSO-1259138/GH-2618 ": get_time does not return correct year in tm.tm_year if year is 1" +// GH-6129 ": time_get::do_get uses the wrong format for %c and %x" tm helper(const char* const s, const char* const fmt) { tm t{}; @@ -60,9 +61,9 @@ tuple read_date(const char* const s) { const auto t = helper(s, "%x"); // %x The date, using the locale's date format. - // "%d / %m / %y" - // %d The day of the month [01,31]; leading zeros are permitted but not required. + // "%m/%d/%y" // %m The month number [01,12]; leading zeros are permitted but not required. + // %d The day of the month [01,31]; leading zeros are permitted but not required. // %y The year within century. When a century is not otherwise specified, // values in the range [69,99] shall refer to years 1969 to 1999 inclusive, and // values in the range [00,68] shall refer to years 2000 to 2068 inclusive; @@ -142,9 +143,9 @@ int main() { assert(read_hour("11 PM") == 23); assert(read_hour("11 pm") == 23); - assert(read_date("22 / 4 / 77") == make_tuple(22, /*NOTE DIFFERENCE:*/ 3, 77)); + assert(read_date("04/22/77") == make_tuple(22, /*NOTE DIFFERENCE:*/ 3, 77)); - assert(read_date("22 / 4 / 11") == make_tuple(22, /*NOTE DIFFERENCE:*/ 3, /*NOTE DIFFERENCE:*/ 111)); + assert(read_date("04/22/11") == make_tuple(22, /*NOTE DIFFERENCE:*/ 3, /*NOTE DIFFERENCE:*/ 111)); assert(read_time("15 : 47 : 58") == make_tuple(15, 47, 58)); diff --git a/tests/std/tests/GH_6129_time_get_do_get_format/env.lst b/tests/std/tests/GH_6129_time_get_do_get_format/env.lst new file mode 100644 index 00000000000..19f025bd0e6 --- /dev/null +++ b/tests/std/tests/GH_6129_time_get_do_get_format/env.lst @@ -0,0 +1,4 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +RUNALL_INCLUDE ..\usual_matrix.lst diff --git a/tests/std/tests/GH_6129_time_get_do_get_format/test.cpp b/tests/std/tests/GH_6129_time_get_do_get_format/test.cpp new file mode 100644 index 00000000000..94b3baace37 --- /dev/null +++ b/tests/std/tests/GH_6129_time_get_do_get_format/test.cpp @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include +#include +#include +#include + +using I = const char*; + +struct time_get_char : std::time_get { + explicit time_get_char(std::size_t refs = 0) : time_get(refs) {} +}; + +int main() { + const time_get_char f(1); + std::ios str(nullptr); + std::ios_base::iostate err; + std::tm t; + + // %c in the C locale uses "%a %b %e %T %Y" + { + const char in[] = "Thu Jun 6 09:49:10 2009"; + err = std::ios_base::goodbit; + t = std::tm(); + I i = f.get(I(in), I(in + sizeof(in) - 1), str, err, &t, 'c'); + assert(err == std::ios_base::eofbit); + assert(i == in + sizeof(in) - 1); + assert(t.tm_wday == 4); + assert(t.tm_mon == 5); + assert(t.tm_mday == 6); + assert(t.tm_hour == 9); + assert(t.tm_min == 49); + assert(t.tm_sec == 10); + assert(t.tm_year == 109); + } + + // %x in the C locale uses "%m/%d/%y" + { + const char in[] = "03/15/09"; + err = std::ios_base::goodbit; + t = std::tm(); + I i = f.get(I(in), I(in + sizeof(in) - 1), str, err, &t, 'x'); + assert(err == std::ios_base::eofbit); + assert(i == in + sizeof(in) - 1); + assert(t.tm_mon == 2); + assert(t.tm_mday == 15); + assert(t.tm_year == 109); + } +} From a425d31a42fb786b993d53e9dfa6395c063194c6 Mon Sep 17 00:00:00 2001 From: BrandonPacewic <92102436+BrandonPacewic@users.noreply.github.com> Date: Mon, 2 Mar 2026 20:26:09 -0800 Subject: [PATCH 2/6] chore: add leading zeros to test dir --- tests/std/test.lst | 2 +- .../env.lst | 0 .../test.cpp | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename tests/std/tests/{GH_6129_time_get_do_get_format => GH_006129_time_get_do_get_format}/env.lst (100%) rename tests/std/tests/{GH_6129_time_get_do_get_format => GH_006129_time_get_do_get_format}/test.cpp (100%) diff --git a/tests/std/test.lst b/tests/std/test.lst index e7f3754d164..9db5e346f79 100644 --- a/tests/std/test.lst +++ b/tests/std/test.lst @@ -280,7 +280,7 @@ tests\GH_005768_pow_accuracy tests\GH_005780_non_ascii_locales tests\GH_005800_stable_sort_large_alignment tests\GH_005968_headers_provide_begin_end -tests\GH_6129_time_get_do_get_format +tests\GH_006129_time_get_do_get_format tests\LWG2381_num_get_floating_point tests\LWG2510_tag_classes tests\LWG2597_complex_branch_cut diff --git a/tests/std/tests/GH_6129_time_get_do_get_format/env.lst b/tests/std/tests/GH_006129_time_get_do_get_format/env.lst similarity index 100% rename from tests/std/tests/GH_6129_time_get_do_get_format/env.lst rename to tests/std/tests/GH_006129_time_get_do_get_format/env.lst diff --git a/tests/std/tests/GH_6129_time_get_do_get_format/test.cpp b/tests/std/tests/GH_006129_time_get_do_get_format/test.cpp similarity index 100% rename from tests/std/tests/GH_6129_time_get_do_get_format/test.cpp rename to tests/std/tests/GH_006129_time_get_do_get_format/test.cpp From 1d99361e914d0df6b9bd7242439cf94140134b0f Mon Sep 17 00:00:00 2001 From: BrandonPacewic <92102436+BrandonPacewic@users.noreply.github.com> Date: Mon, 2 Mar 2026 20:33:42 -0800 Subject: [PATCH 3/6] fix: update `P0355R7_calendars_and_time_zones_io` test inputs for `%c` and `%x` --- .../test.cpp | 96 +++++++++---------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/tests/std/tests/P0355R7_calendars_and_time_zones_io/test.cpp b/tests/std/tests/P0355R7_calendars_and_time_zones_io/test.cpp index a5683460375..58ac3d2041f 100644 --- a/tests/std/tests/P0355R7_calendars_and_time_zones_io/test.cpp +++ b/tests/std/tests/P0355R7_calendars_and_time_zones_io/test.cpp @@ -639,10 +639,10 @@ void parse_calendar_types_basic() { // basic %D test test_parse("07/04/76 17", "%D %C", ymd); assert(ymd == July / 4d / 1776y); - // locale's date representation %x (== "%d / %m / %y") - test_parse("04/07/76 17", "%x %C", ymd); + // locale's date representation %x (== "%m/%d/%y") + test_parse("07/04/76 17", "%x %C", ymd); assert(ymd == 4d / July / 1776y); - test_parse("10/12/15 18", "%x %C", ymd); + test_parse("12/10/15 18", "%x %C", ymd); assert(ymd == 10d / December / 1815y); // day-of-year tests, leap and non-leap years @@ -972,10 +972,10 @@ void parse_timepoints() { file_time ft; local_seconds lt; - test_parse("oct 29 19:01:42 2020", "%c", st); - test_parse("oct 29 19:01:42 2020", "%c", ut); - test_parse("oct 29 19:01:42 2020", "%c", ft); - test_parse("oct 29 19:01:42 2020", "%c", lt); + test_parse("thu oct 29 19:01:42 2020", "%c", st); + test_parse("thu oct 29 19:01:42 2020", "%c", ut); + test_parse("thu oct 29 19:01:42 2020", "%c", ft); + test_parse("thu oct 29 19:01:42 2020", "%c", lt); assert(st == ref); assert(ut == clock_cast(ref)); @@ -983,16 +983,16 @@ void parse_timepoints() { assert(lt.time_since_epoch() == ref.time_since_epoch()); minutes offset; - test_parse("oct 29 19:01:42 2020 0430", "%c %z", st, nullptr, &offset); + test_parse("thu oct 29 19:01:42 2020 0430", "%c %z", st, nullptr, &offset); assert(st == ref - offset && offset == 4h + 30min); - test_parse("oct 29 19:01:42 2020 0430", "%c %z", ut, nullptr, &offset); + test_parse("thu oct 29 19:01:42 2020 0430", "%c %z", ut, nullptr, &offset); assert(ut == clock_cast(ref) - offset && offset == 4h + 30min); - test_parse("oct 29 19:01:42 2020 0430", "%c %z", ft, nullptr, &offset); + test_parse("thu oct 29 19:01:42 2020 0430", "%c %z", ft, nullptr, &offset); assert(ft == clock_cast(ref) - offset && offset == 4h + 30min); - test_parse("oct 29 19:01:42 2020 0430", "%c %z", lt, nullptr, &offset); + test_parse("thu oct 29 19:01:42 2020 0430", "%c %z", lt, nullptr, &offset); assert(lt.time_since_epoch() == ref.time_since_epoch() && offset == 4h + 30min); // N4878 [time.clock.tai]/1: @@ -1004,13 +1004,13 @@ void parse_timepoints() { ref = sys_days{1957y / December / 31d} + days{1} - 10s; tai_seconds tt; - test_parse("jan 1 00:00:00 1958", "%c", tt); + test_parse("wed jan 1 00:00:00 1958", "%c", tt); assert(tt == clock_cast(ref)); ref = sys_days{2000y / January / 1d}; - test_parse("jan 1 00:00:32 2000", "%c", tt); + test_parse("sat jan 1 00:00:32 2000", "%c", tt); assert(tt == clock_cast(ref)); - test_parse("jan 1 00:00:32 2000 0430", "%c %z", tt, nullptr, &offset); + test_parse("sat jan 1 00:00:32 2000 0430", "%c %z", tt, nullptr, &offset); assert(tt == clock_cast(ref) - offset && offset == 4h + 30min); // N4878 [time.clock.gps]/1: @@ -1022,11 +1022,11 @@ void parse_timepoints() { gps_seconds gt; ref = sys_days{1980y / January / 6d}; - test_parse("jan 6 00:00:00 1980 0430", "%c %z", gt, nullptr, &offset); + test_parse("sun jan 6 00:00:00 1980 0430", "%c %z", gt, nullptr, &offset); assert(gt == clock_cast(ref) - offset && offset == 4h + 30min); - test_parse("jan 6 00:00:00 1980", "%c", gt); + test_parse("sun jan 6 00:00:00 1980", "%c", gt); assert(gt == clock_cast(ref)); - test_parse("jan 6 00:00:19 1980", "%c", tt); + test_parse("sun jan 6 00:00:19 1980", "%c", tt); assert(gt == clock_cast(tt)); seconds time; @@ -1074,75 +1074,75 @@ void parse_timepoints() { } utc_seconds ut_ref = utc_clock::from_sys(sys_days{1d / July / 1972y}) - 1s; // leap second insertion - test_parse("june 30 23:59:60 1972", "%c", ut); + test_parse("fri june 30 23:59:60 1972", "%c", ut); assert(ut == ut_ref); // Test a later leap second, where the accumulated offset is greater than 1s. ut_ref = utc_clock::from_sys(sys_days{1d / July / 1992y}) - 1s; - test_parse("june 30 23:59:60 1992", "%c", ut); + test_parse("tue june 30 23:59:60 1992", "%c", ut); assert(ut == ut_ref); // not leap-second aware - fail_parse("june 30 23:59:60 1972", "%c", st); - fail_parse("june 30 23:59:60 1972", "%c", tt); - fail_parse("june 30 23:59:60 1972", "%c", gt); - fail_parse("june 30 23:59:60 1972", "%c", ft); + fail_parse("fri june 30 23:59:60 1972", "%c", st); + fail_parse("fri june 30 23:59:60 1972", "%c", tt); + fail_parse("fri june 30 23:59:60 1972", "%c", gt); + fail_parse("fri june 30 23:59:60 1972", "%c", ft); - fail_parse("june 30 23:59:60 1973", "%c", ut); // not a leap second insertion + fail_parse("sat june 30 23:59:60 1973", "%c", ut); // not a leap second insertion // the last leap second insertion that file_clock is not aware of - test_parse("dec 31 23:59:59 2016", "%c", ut); - test_parse("dec 31 23:59:59 2016", "%c", ft); + test_parse("sat dec 31 23:59:59 2016", "%c", ut); + test_parse("sat dec 31 23:59:59 2016", "%c", ft); assert(ft == clock_cast(ut)); - test_parse("dec 31 23:59:60 2016", "%c", ut); - fail_parse("dec 31 23:59:60 2016", "%c", ft); + test_parse("sat dec 31 23:59:60 2016", "%c", ut); + fail_parse("sat dec 31 23:59:60 2016", "%c", ft); - test_parse("jan 01 00:00:00 2017", "%c", ut); - test_parse("jan 01 00:00:00 2017", "%c", ft); + test_parse("sun jan 01 00:00:00 2017", "%c", ut); + test_parse("sun jan 01 00:00:00 2017", "%c", ft); assert(ft == clock_cast(ut)); ref = sys_days{1d / January / 2020y} - 1s; // negative leap second, UTC time doesn't exist - fail_parse("dec 31 23:59:59 2019", "%c", ut); - fail_parse("dec 31 23:59:59 2019", "%c", ft); + fail_parse("tue dec 31 23:59:59 2019", "%c", ut); + fail_parse("tue dec 31 23:59:59 2019", "%c", ft); - test_parse("dec 31 23:59:59 2019", "%c", st); + test_parse("tue dec 31 23:59:59 2019", "%c", st); assert(st == ref); - test_parse("dec 31 23:59:59 2019", "%c", lt); // Not UTC, might be valid depending on the time zone. + test_parse("tue dec 31 23:59:59 2019", "%c", lt); // Not UTC, might be valid depending on the time zone. assert(lt.time_since_epoch() == ref.time_since_epoch()); // Initially, TAI - UTC == 37s. - test_parse("dec 31 23:59:59 2019", "%c", tt); - test_parse("dec 31 23:59:22 2019", "%c", ut); + test_parse("tue dec 31 23:59:59 2019", "%c", tt); + test_parse("tue dec 31 23:59:22 2019", "%c", ut); assert(tt == clock_cast(ut)); - test_parse("jan 01 00:00:35 2020", "%c", tt); - test_parse("dec 31 23:59:58 2019", "%c", ut); + test_parse("wed jan 01 00:00:35 2020", "%c", tt); + test_parse("tue dec 31 23:59:58 2019", "%c", ut); assert(tt == clock_cast(ut)); - test_parse("jan 01 00:00:36 2020", "%c", tt); - test_parse("jan 01 00:00:00 2020", "%c", ut); + test_parse("wed jan 01 00:00:36 2020", "%c", tt); + test_parse("wed jan 01 00:00:00 2020", "%c", ut); assert(tt == clock_cast(ut)); // Initially, GPS - UTC == 18s - test_parse("dec 31 23:59:59 2019", "%c", gt); - test_parse("dec 31 23:59:41 2019", "%c", ut); + test_parse("tue dec 31 23:59:59 2019", "%c", gt); + test_parse("tue dec 31 23:59:41 2019", "%c", ut); assert(gt == clock_cast(ut)); - test_parse("jan 01 00:00:16 2020", "%c", gt); - test_parse("dec 31 23:59:58 2019", "%c", ut); + test_parse("wed jan 01 00:00:16 2020", "%c", gt); + test_parse("tue dec 31 23:59:58 2019", "%c", ut); assert(gt == clock_cast(ut)); - test_parse("jan 01 00:00:17 2020", "%c", gt); - test_parse("jan 01 00:00:00 2020", "%c", ut); + test_parse("wed jan 01 00:00:17 2020", "%c", gt); + test_parse("wed jan 01 00:00:00 2020", "%c", ut); assert(gt == clock_cast(ut)); ut_ref = utc_clock::from_sys(sys_days{1d / January / 2022y}) - 1s; // leap second insertion - test_parse("dec 31 23:59:60 2021", "%c", ut); + test_parse("fri dec 31 23:59:60 2021", "%c", ut); assert(ut == ut_ref); - test_parse("dec 31 23:59:60 2021", "%c", ft); + test_parse("fri dec 31 23:59:60 2021", "%c", ft); assert(ft == clock_cast(ut_ref)); From ffa2db1c6a5262e2b65ee4edaec3ac9f6e811299 Mon Sep 17 00:00:00 2001 From: BrandonPacewic <92102436+BrandonPacewic@users.noreply.github.com> Date: Thu, 5 Mar 2026 01:03:58 -0800 Subject: [PATCH 4/6] fix: fold `GH_006129` test into `Dev11_0836436_get_time` --- tests/std/test.lst | 1 - .../std/tests/Dev11_0836436_get_time/test.cpp | 26 ++++++++++ .../GH_006129_time_get_do_get_format/env.lst | 4 -- .../GH_006129_time_get_do_get_format/test.cpp | 50 ------------------- 4 files changed, 26 insertions(+), 55 deletions(-) delete mode 100644 tests/std/tests/GH_006129_time_get_do_get_format/env.lst delete mode 100644 tests/std/tests/GH_006129_time_get_do_get_format/test.cpp diff --git a/tests/std/test.lst b/tests/std/test.lst index 9db5e346f79..2751839bf3d 100644 --- a/tests/std/test.lst +++ b/tests/std/test.lst @@ -280,7 +280,6 @@ tests\GH_005768_pow_accuracy tests\GH_005780_non_ascii_locales tests\GH_005800_stable_sort_large_alignment tests\GH_005968_headers_provide_begin_end -tests\GH_006129_time_get_do_get_format tests\LWG2381_num_get_floating_point tests\LWG2510_tag_classes tests\LWG2597_complex_branch_cut diff --git a/tests/std/tests/Dev11_0836436_get_time/test.cpp b/tests/std/tests/Dev11_0836436_get_time/test.cpp index 78f44a827e6..934116022cf 100644 --- a/tests/std/tests/Dev11_0836436_get_time/test.cpp +++ b/tests/std/tests/Dev11_0836436_get_time/test.cpp @@ -113,6 +113,7 @@ void test_gh_2618(); void test_gh_2848(); void test_gh_4820(); void test_gh_4882(); +void test_gh_6129(); int main() { assert(read_hour("12 AM") == 0); @@ -161,6 +162,7 @@ int main() { test_gh_2848(); test_gh_4820(); test_gh_4882(); + test_gh_6129(); } typedef istreambuf_iterator Iter; @@ -911,6 +913,30 @@ void test_gh_4820() { } } +void test_gh_6129() { + // GH-6129 ": time_get::do_get uses the wrong format for %c and %x" + + // %c in the C locale uses "%a %b %e %T %Y" + { + const auto t = helper("Thu Jun 6 09:49:10 2009", "%c"); + assert(t.tm_wday == 4); + assert(t.tm_mon == 5); + assert(t.tm_mday == 6); + assert(t.tm_hour == 9); + assert(t.tm_min == 49); + assert(t.tm_sec == 10); + assert(t.tm_year == 109); + } + + // %x in the C locale uses "%m/%d/%y" + { + const auto t = helper("03/15/09", "%x"); + assert(t.tm_mon == 2); + assert(t.tm_mday == 15); + assert(t.tm_year == 109); + } +} + void test_gh_4882() { // GH-4882 : std::put_time should not crash on invalid/out-of-range tm struct values const auto fieldValidation = [](int tm::* const field, const int value, const string& fmt) { diff --git a/tests/std/tests/GH_006129_time_get_do_get_format/env.lst b/tests/std/tests/GH_006129_time_get_do_get_format/env.lst deleted file mode 100644 index 19f025bd0e6..00000000000 --- a/tests/std/tests/GH_006129_time_get_do_get_format/env.lst +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -RUNALL_INCLUDE ..\usual_matrix.lst diff --git a/tests/std/tests/GH_006129_time_get_do_get_format/test.cpp b/tests/std/tests/GH_006129_time_get_do_get_format/test.cpp deleted file mode 100644 index 94b3baace37..00000000000 --- a/tests/std/tests/GH_006129_time_get_do_get_format/test.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#include -#include -#include -#include - -using I = const char*; - -struct time_get_char : std::time_get { - explicit time_get_char(std::size_t refs = 0) : time_get(refs) {} -}; - -int main() { - const time_get_char f(1); - std::ios str(nullptr); - std::ios_base::iostate err; - std::tm t; - - // %c in the C locale uses "%a %b %e %T %Y" - { - const char in[] = "Thu Jun 6 09:49:10 2009"; - err = std::ios_base::goodbit; - t = std::tm(); - I i = f.get(I(in), I(in + sizeof(in) - 1), str, err, &t, 'c'); - assert(err == std::ios_base::eofbit); - assert(i == in + sizeof(in) - 1); - assert(t.tm_wday == 4); - assert(t.tm_mon == 5); - assert(t.tm_mday == 6); - assert(t.tm_hour == 9); - assert(t.tm_min == 49); - assert(t.tm_sec == 10); - assert(t.tm_year == 109); - } - - // %x in the C locale uses "%m/%d/%y" - { - const char in[] = "03/15/09"; - err = std::ios_base::goodbit; - t = std::tm(); - I i = f.get(I(in), I(in + sizeof(in) - 1), str, err, &t, 'x'); - assert(err == std::ios_base::eofbit); - assert(i == in + sizeof(in) - 1); - assert(t.tm_mon == 2); - assert(t.tm_mday == 15); - assert(t.tm_year == 109); - } -} From d64bcc511d813ed264664d77b3ffa7d6870e5609 Mon Sep 17 00:00:00 2001 From: BrandonPacewic <92102436+BrandonPacewic@users.noreply.github.com> Date: Thu, 12 Mar 2026 14:30:29 -0700 Subject: [PATCH 5/6] fix: restore spaces in `%x` format string for consistency with `%D` and `%T --- stl/inc/xloctime | 2 +- tests/std/tests/Dev11_0836436_get_time/test.cpp | 4 ++-- tests/std/tests/P0355R7_calendars_and_time_zones_io/test.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stl/inc/xloctime b/stl/inc/xloctime index bc9db01828f..d3aa110e723 100644 --- a/stl/inc/xloctime +++ b/stl/inc/xloctime @@ -547,7 +547,7 @@ protected: break; case 'x': - _First = _Getfmt(_First, _Last, _Iosbase, _State, _Pt, "%m/%d/%y"); + _First = _Getfmt(_First, _Last, _Iosbase, _State, _Pt, "%m / %d / %y"); break; case 'y': diff --git a/tests/std/tests/Dev11_0836436_get_time/test.cpp b/tests/std/tests/Dev11_0836436_get_time/test.cpp index 934116022cf..045225ad3a3 100644 --- a/tests/std/tests/Dev11_0836436_get_time/test.cpp +++ b/tests/std/tests/Dev11_0836436_get_time/test.cpp @@ -61,7 +61,7 @@ tuple read_date(const char* const s) { const auto t = helper(s, "%x"); // %x The date, using the locale's date format. - // "%m/%d/%y" + // "%m / %d / %y" // %m The month number [01,12]; leading zeros are permitted but not required. // %d The day of the month [01,31]; leading zeros are permitted but not required. // %y The year within century. When a century is not otherwise specified, @@ -928,7 +928,7 @@ void test_gh_6129() { assert(t.tm_year == 109); } - // %x in the C locale uses "%m/%d/%y" + // %x in the C locale uses "%m / %d / %y" { const auto t = helper("03/15/09", "%x"); assert(t.tm_mon == 2); diff --git a/tests/std/tests/P0355R7_calendars_and_time_zones_io/test.cpp b/tests/std/tests/P0355R7_calendars_and_time_zones_io/test.cpp index 58ac3d2041f..72c50526682 100644 --- a/tests/std/tests/P0355R7_calendars_and_time_zones_io/test.cpp +++ b/tests/std/tests/P0355R7_calendars_and_time_zones_io/test.cpp @@ -639,7 +639,7 @@ void parse_calendar_types_basic() { // basic %D test test_parse("07/04/76 17", "%D %C", ymd); assert(ymd == July / 4d / 1776y); - // locale's date representation %x (== "%m/%d/%y") + // locale's date representation %x (== "%m / %d / %y") test_parse("07/04/76 17", "%x %C", ymd); assert(ymd == 4d / July / 1776y); test_parse("12/10/15 18", "%x %C", ymd); From 87e758cda860d9a3ab62e84e0fee46484cb7d90f Mon Sep 17 00:00:00 2001 From: BrandonPacewic <92102436+BrandonPacewic@users.noreply.github.com> Date: Thu, 12 Mar 2026 18:11:26 -0700 Subject: [PATCH 6/6] chore: re-run ci