Subject: bug#39248: format-time-string ignores user's preferred locale

From: Paul Eggert <[email-masked]>
Date: Thu, 23 Jan 2020 00:38:38 -0800

Thanks for the bug report. I don't observe the problem on GNU/Linux; for 
example, the following shell command:

LC_ALL=en_AU.utf8 emacs -Q -batch -eval '(message "%s" (format-time-string "%x"))'

outputs "23/01/20", which is the same thing that the shell command 
"LC_ALL=en_AU.utf8 date +%x" outputs. I don't have easy access to macOS so I'll 
need your help to debug this.

I suggest that you build Emacs with debug symbols and with optimization off 
(e.g., "make clean; make CFLAGS='-g3 -O0'"), and then run it under a debugger, 
and plant a breakpoint on the nstrftime function and then single-step and see 
what goes wrong. Something like this:

$ make clean
$ make CFLAGS='-g3 -O0'
$ gdb src/emacs
(gdb) b nstrftime
(gdb) r -Q -batch -eval '(message "%s" (format-time-string "%x"))'
(gdb) n
(gdb) n
...

This will help us see whether the bug is in Emacs or in the underlying strftime 
function.