You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Printing with MSVC does not work properly using the Timezone.
When running this example with MSVC
fmt::print("Got now as {:%FT%T%z}\n",
std::chrono::time_pointstd::chrono::system_clock::clock::now());
I get the output:
Got now as 2024-01-18T07:09:51.3559309+0100
The timestamp is UTC (local time was 08:09) and UTC time is indeed 07:09, but my time zone (+0100) is printed instead of the correct +0000. On GCC (12.2 on debian) I get the correct time and timezone.
Tested with fmt 10.2.1 and current master. Minimum sample is here: minimum sample.zip
Changing CXX_STANDARD from 20 to 11 does not lead to different results.
The text was updated successfully, but these errors were encountered:
System clock is normally UTC as far as i know (https://en.cppreference.com/w/cpp/chrono/system_clock), so it should print UTC time +0000. This is done on my gcc 12.2 on debian.
I got the weird behavior with timestamp in fact as within UTC but local timezone (+0100) instead of UTC Timezone (+0000) appended.
constauto& facet = std::use_facet<std::time_put<Char>>(loc);
auto end = facet.put(os, os, Char(''), &time, format, modifier);
in do_write in chrono.h, after calling facet.put, we get the local timezone for Z/z.
Edit:
It does look it's getting the localized timezone, since there is no info about what the timezone actually is in this function, I am suprised it works fine on GCC.
Printing with MSVC does not work properly using the Timezone.
When running this example with MSVC
fmt::print("Got now as {:%FT%T%z}\n",
std::chrono::time_pointstd::chrono::system_clock::clock::now());
I get the output:
Got now as 2024-01-18T07:09:51.3559309+0100
The timestamp is UTC (local time was 08:09) and UTC time is indeed 07:09, but my time zone (+0100) is printed instead of the correct +0000. On GCC (12.2 on debian) I get the correct time and timezone.
Tested with fmt 10.2.1 and current master. Minimum sample is here:
minimum sample.zip
Changing CXX_STANDARD from 20 to 11 does not lead to different results.
The text was updated successfully, but these errors were encountered: