]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Tweak %c formatting for chrono types
authorJonathan Wakely <jwakely@redhat.com>
Fri, 27 Sep 2024 15:54:31 +0000 (16:54 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 9 Oct 2024 12:39:15 +0000 (13:39 +0100)
libstdc++-v3/ChangeLog:

* include/bits/chrono_io.h (__formatter_chrono::_M_c): Add
[[unlikely]] attribute to condition for missing %c format in
locale. Use %T instead of %H:%M:%S in fallback.

libstdc++-v3/include/bits/chrono_io.h

index a337007266e936cdcd77a0f5c32b7881e5e9a4db..652e88ffe3abbfa78b769c70c3efbae9207a9804 100644 (file)
@@ -899,8 +899,8 @@ namespace __format
          const _CharT* __formats[2];
          __tp._M_date_time_formats(__formats);
          const _CharT* __rep = __formats[__mod];
-         if (!*__rep)
-           __rep = _GLIBCXX_WIDEN("%a %b %e %H:%M:%S %Y");
+         if (!*__rep) [[unlikely]]
+           __rep = _GLIBCXX_WIDEN("%a %b %e %T %Y");
          basic_string<_CharT> __fmt(_S_empty_spec);
          __fmt.insert(1u, 1u, _S_colon);
          __fmt.insert(2u, __rep);