The custom date format I use is "%a, %d %b %Y %T %z" which works on Linux producing something like:
Thu, 28 Oct 2021 14:14:21 +1100
However this same format doesn't work on Windows (produces nothing at all). In theory I would have thought strftime() would be the same for both platforms.
Which version of Geany?
If not 1.38 on Windows please consider updating since that _should_ avoid 32/64 bit issues that may affect time structures.
Geany is 1.38 on 64-bit Windows. I am 64-bit on all my Linux distros as well.
Ok, that was all I had, Windows expert needed :frowning_face:
No Windows expert here but anyway: - do you see any errors or warnings possibly related to the date format in `Help -> Debug Messages`? - can you try a more simple date format to see whether any format would work at all, maybe `%Y`?
can you try a more simple date format to see whether any format would work at all, maybe %Y?
Google tells me that all the OPs format letters are supported on at least some version of Windows.
@elextr I am Linux only until Monday my time, I'll let you know the answers as soon as I can then.
@eht16 %Y by itself works. After lots of playing, it looks like it is the %T that kills it. Removing that makes the rest work.
Nothing in the debug window from using the date format.
%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?
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 :(
%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...
I wrote a simple test program to better see the differences between Linux (glibc) and Windows (MSVCRT).
Which windows version did you try? Windows 10, 11, olde? Sigh!!!
Switching to GLib DateTime API should be fairly easy, I'm only wondering if this might break other format specfifiers.
I guess we could refer to the Glib (currently broken) documentation then since it will be consistent across implementations.
Windows is so much fun...
Not.
I wrote a simple test program to better see the differences between Linux (glibc) and Windows (MSVCRT).
Which windows version did you try? Windows 10, 11, olde? Sigh!!!
Good ol' Windows 7. I will never use anything newer.
Switching to GLib DateTime API should be fairly easy, I'm only wondering if this might break other format specfifiers.
#3037 is there and has information about missing format conversions.
If there are no objections, I'll merge this in a few days.
Closed #2968 via #3037.
github-comments@lists.geany.org