Open justinmcgrath opened 3 years ago
Unrelated to the problem, do you maybe want to use the mingw gcc instead? pacman -S mingw-w64-x86_64-toolchain
-> open a mingw64 shell, use g++ there.
That is what I've done, so maybe I should I report this to mingw instead?
Yeah, I think I've confused something things. If I use an MSYS terminal, and change localtime_s(&tm, &timet);
to localtime_r(&timet, &tm);
in order to match the different libraries, then everything works correctly. The problem appears to be in mingw.
I see. I get under mingw64: 08:53:00W. Europe Daylight Time
and under ucrt64: 08:53:23+0200
So it looks to me that msvcrt is lacking those features. This looks related: https://sourceforge.net/p/mingw-w64/bugs/793/
If you depend on your mingw builds behaving like with MSVC I'd suggest to use the ucrt64 (or clang) environment instead. See https://www.msys2.org/docs/environments/ for details
Ah, I haven't used msys in a while and didn't realize it worked this way. How do I install the ucrt64 environment? I can't seem to figure it out.
It's there by default, C:/msys64/ucrt64.exe
. its packages/groups start with mingw-w64-ucrt-x86_64-
, for example pacman -S mingw-w64-ucrt-x86_64-toolchain
Ah, thank you.
On Thu, Aug 26, 2021 at 4:22 PM Christoph Reiter @.***> wrote:
It's there by default, C:/msys64/ucrt64.exe. its packages/groups start with mingw-w64-ucrt-x86_64-, for example pacman -S mingw-w64-ucrt-x86_64-toolchain
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/msys2/MINGW-packages/issues/9472#issuecomment-906752398, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACB3DN3WDGFG66HUCYTKM4TT62WCLANCNFSM5C37AYBQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
There's a very good chance I just don't understand what is going on, but this does not work as I'd expect (not my code).
Using MSYS2 (installed with msys2-x86_64-20210725.exe) and g++ version 10.3.0, this outputs something like "11:55:59Central Daylight Time", but it should be "11:55:59-0500".
"%z" is supposed to return the offset from UTC. "%Z" is supposed to return the time zone name. Both are outputting the name. On a similar vein, "%F" and "%T" do not work at all.
Compiling on Ubuntu 20.04 with whatever that latest g++ is works as expected.
Links to strftime descriptions for MS and the standard: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l?view=msvc-160 https://www.cplusplus.com/reference/ctime/strftime/