]> Savannah Git Hosting - gnulib.git/commitdiff
nstrftime, c-nstrftime: Make %r work on native Windows.
authorBruno Haible <bruno@clisp.org>
Mon, 27 May 2024 21:29:36 +0000 (23:29 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 27 May 2024 21:29:36 +0000 (23:29 +0200)
* doc/posix-functions/strftime.texi: Mention the %r problem.
* lib/strftime.c (__strftime_internal): On native Windows, for %r, use
the English AM/PM format.

ChangeLog
doc/posix-functions/strftime.texi
lib/strftime.c

index a9dc4859ca95fc60ba4110df3c245393eca50de4..a49563431c5b5ebc5c6f6ad4e15926c7a82bfcf7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-05-27  Bruno Haible  <bruno@clisp.org>
+
+       nstrftime, c-nstrftime: Make %r work on native Windows.
+       * doc/posix-functions/strftime.texi: Mention the %r problem.
+       * lib/strftime.c (__strftime_internal): On native Windows, for %r, use
+       the English AM/PM format.
+
 2024-05-27  Bruno Haible  <bruno@clisp.org>
 
        nstrftime, c-nstrftime: Make %h work on native Windows.
index 7cba218a9725f9e9ac63b4a7203079d4ecdd1b9c..3a2eceb8ef479cce2a35ce0307345d1d964acb59 100644 (file)
@@ -28,6 +28,9 @@ mingw, MSVC.
 The %h specifier produces empty output on some platforms:
 mingw, MSVC.
 @item
+The %r specifier produces empty output on some platforms:
+mingw, MSVC.
+@item
 The %r specifier produces empty output, at least in a French locale,
 on some platforms:
 macOS 12.5, FreeBSD 14.0.
index ccfa79daac12a1023fc465e16fd549603549e89b..8eeea45ef4634cb32ad63f1537e94e84586a7ad3 100644 (file)
@@ -1717,8 +1717,9 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
 #elif USE_C_LOCALE && !HAVE_STRFTIME_L
           subfmt = L_("%I:%M:%S %p");
           goto subformat;
-#elif (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__
-          /* macOS, FreeBSD strftime() may produce empty output for "%r".  */
+#elif (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || (defined _WIN32 && !defined __CYGWIN__)
+          /* macOS, FreeBSD, native Windows strftime() may produce empty output
+             for "%r".  */
           subfmt = L_("%I:%M:%S %p");
           goto subformat;
 #else