diff mbox series

libstdc++: Tweak %c formatting for chrono types

Message ID 20241002193724.3359839-1-jwakely@redhat.com
State New
Headers show
Series libstdc++: Tweak %c formatting for chrono types | expand

Commit Message

Jonathan Wakely Oct. 2, 2024, 7:37 p.m. UTC
Tested x86_64-linux.

-- >8 --

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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h
index a337007266e..652e88ffe3a 100644
--- a/libstdc++-v3/include/bits/chrono_io.h
+++ b/libstdc++-v3/include/bits/chrono_io.h
@@ -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);