Collin Funk wrote in
https://lists.gnu.org/archive/html/bug-gnulib/2025-07/msg00214.html:
> This part of the function body of
> gl_locale_name_environ should make it clear:
>
> /* Setting of LC_ALL overrides all other. */
> retval = getenv ("LC_ALL");
> if (retval != NULL && retval[0] != '\0')
> return retval;
> /* Next comes the name of the desired category. */
> retval = getenv (categoryname);
> if (retval != NULL && retval[0] != '\0')
> return retval;
>
> So, despite setting 'setlocale (LC_TIME, "C")' when doing
> 'LC_ALL=am_ET.UTF-8 date --iso-8601=hours' we will receive the value
> from LC_ALL in the environment.
There are basically two ways to fix this:
(a) set the appropriate environment variables (instead of setlocale calls),
(b) add an nstrftime_l and fprintftime_l variant and pass a locale that
has "C" for the LC_TIME category.
(b) is more hairy, when it comes to the "underlying strftime" delegation in
gnulib/lib/strftime.c.
Therefore here is a proposed fix according to (a). It fixes the test failures
on macOS and OpenBSD. It also passes "make syntax-check".