%T is documented in the [MS version](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wc...) of strftime() but @eht16 is that used, or is some msys2 version of strftime() used?
I think MSVCRT is used, i.e. one of the Windows C runtimes. It seems nowadays, there is MSVCRT and UCRT which seems to be a newer implementation of the C runtime on Windows (and only available since Windows 10). I found https://www.msys2.org/docs/environments/ and https://sourceforge.net/p/mingw-w64/bugs/793/. Possibly MSVCRT does not support `%T` while UCRT does.
Replacing %T with %H:%M:%S works interestingly enough, which gets around the problem in the original post.
However a new problem emerges, the Windows version is interpreting %z as %Z (in fact they do the same on Windows). On Linux %z correctly gives the numeric offset from UTC, and %Z gives an abbreviated version of the timezone name. It wouldn't be so bad, but the Windows version isn't abbreviated, you get a whole sentence :(
Wow, yes, could reproduce.
I wrote a simple [test program](https://gist.github.com/eht16/757cc4e814da41a9e8d7a8fba443232f) to better see the differences between Linux (glibc) and Windows (MSVCRT). The results: ``` Windows:
Format: %a, %d %b %Y %T %z: CRT : Error: Invalid argument GLib: Sun, 07 Nov 2021 23:18:31 +0100
Format: %a, %d %b %Y %T %Z: CRT : Error: Invalid argument GLib: Sun, 07 Nov 2021 23:18:31 W. Europe Standard Time
Format: %a, %d %b %Y %H:%M:%S %z: CRT : Sun, 07 Nov 2021 23:18:31 W. Europe Standard Time GLib: Sun, 07 Nov 2021 23:18:31 +0100
Format: %a, %d %b %Y %H:%M:%S %Z: CRT : Sun, 07 Nov 2021 23:18:31 W. Europe Standard Time GLib: Sun, 07 Nov 2021 23:18:31 W. Europe Standard Time
Linux:
Format: %a, %d %b %Y %T %z: CRT : Sun, 07 Nov 2021 23:14:31 +0100 GLib: Sun, 07 Nov 2021 23:14:31 +0100
Format: %a, %d %b %Y %T %Z: CRT : Sun, 07 Nov 2021 23:14:31 CET GLib: Sun, 07 Nov 2021 23:14:31 CET
Format: %a, %d %b %Y %H:%M:%S %z: CRT : Sun, 07 Nov 2021 23:14:31 +0100 GLib: Sun, 07 Nov 2021 23:14:31 +0100
Format: %a, %d %b %Y %H:%M:%S %Z: CRT : Sun, 07 Nov 2021 23:14:31 CET GLib: Sun, 07 Nov 2021 23:14:31 CET ``` The [GLib DateTime API](https://docs.gtk.org/glib/struct.DateTime.html) seems to work better and supports `%T` as well as the expected `%z` and `%Z` behaviour.
However, it have other limitations ("The format strings understood by this function are a subset of the strftime() format language") on https://docs.gtk.org/glib/method.DateTime.format.html. However, I have difficulties to understand what exactly is supported and what not, also because the formatting seems broken on that page.
Switching to GLib DateTime API should be fairly easy, I'm only wondering if this might break other format specfifiers.
Windows is so much fun...