On mingw, I see that the %h specifier testing code runs into the assertion of ASSERT (n > 0).
This patch adds support for the %h specifier. 2024-05-27 Bruno Haible <br...@clisp.org> nstrftime, c-nstrftime: Make %h work on native Windows. * doc/posix-functions/strftime.texi: Mention the %h problem. * lib/strftime.c (__strftime_internal): On native Windows, for %h, do a %b directive. diff --git a/doc/posix-functions/strftime.texi b/doc/posix-functions/strftime.texi index 68af3224a4..7cba218a97 100644 --- a/doc/posix-functions/strftime.texi +++ b/doc/posix-functions/strftime.texi @@ -25,6 +25,9 @@ potentially ambiguous numerical output, on some platforms: mingw, MSVC. @item +The %h 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. diff --git a/lib/strftime.c b/lib/strftime.c index 069bab7095..ccfa79daac 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -1251,6 +1251,9 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) cpy (am_len, a_month); break; #else +# if defined _WIN32 && !defined __CYGWIN__ + format_char = L_('b'); +# endif goto underlying_strftime; #endif