Fix set locale error in chrono formatter

This commit is contained in:
Владислав Щапов 2021-06-11 00:29:17 +05:00 committed by Victor Zverovich
parent 3c8fad126c
commit c123a72844

View File

@ -291,6 +291,7 @@ inline null<> gmtime_s(...) { return null<>(); }
inline auto do_write(const std::tm& time, const std::locale& loc, char format, inline auto do_write(const std::tm& time, const std::locale& loc, char format,
char modifier) -> std::string { char modifier) -> std::string {
auto&& os = std::ostringstream(); auto&& os = std::ostringstream();
os.imbue(loc);
using iterator = std::ostreambuf_iterator<char>; using iterator = std::ostreambuf_iterator<char>;
const auto& facet = std::use_facet<std::time_put<char, iterator>>(loc); const auto& facet = std::use_facet<std::time_put<char, iterator>>(loc);
auto end = facet.put(os, os, ' ', &time, format, modifier); auto end = facet.put(os, os, ' ', &time, format, modifier);