]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Use formatting locale for std::time_put formats
authorJonathan Wakely <jwakely@redhat.com>
Wed, 19 Mar 2025 19:38:15 +0000 (19:38 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 21 Mar 2025 10:28:11 +0000 (10:28 +0000)
commit3c7f2fd8c4b330029c935f2785a5da9395355d7d
treead86c64bb3d3347a191a86c9ed98da870d5ac306
parent3e1d760bf49d0e9a89dcfa0450a6d1ae5ceb756e
libstdc++: Use formatting locale for std::time_put formats

When using std::time_put to format a chrono value, we should imbue the
formatting locale into the stream. This ensures that when
std::time_put::do_put uses a ctype or __timepunct facet from the locale,
it gets the correct facets.

libstdc++-v3/ChangeLog:

* include/bits/chrono_io.h (__formatter_chrono::_M_locale_fmt):
Imbue locale into ostringstream.
* testsuite/std/time/format/localized.cc: Check that correct
locale is used for call to time_put::put.

Reviewed-by: Tomasz KamiƄski <tkaminsk@redhat.com>
libstdc++-v3/include/bits/chrono_io.h
libstdc++-v3/testsuite/std/time/format/localized.cc