> On macOS 12.5 and FreeBSD 14.0, the %r directive of strftime produces no
> output at all in a French locale.

As evidenced by this test program:
================================================================================
#include <assert.h>
#include <errno.h>
#include <locale.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
int main ()
{
  setlocale (LC_ALL, "fr_FR.UTF-8");

  time_t t = 1509000003;
  struct tm *tm = gmtime (&t);
  char buf[100];
  size_t n;

  n = strftime (buf, sizeof buf, "%Y-%m-%d %H:%M:%S", tm);
  assert (n > 0);
  printf ("Format as ISO 8601: %s\n", buf);
  assert (strcmp (buf, "2017-10-26 06:40:03") == 0);

  errno = 0;
  n = strftime (buf, sizeof buf, "%r", tm);
  printf ("%%r directive: |%s|, errno = %d\n", n > 0 ? buf : "", errno);
}
/* Output on
glibc:        |06:40:03 |, errno = 0
macOS 12.5:   ||, errno = 0
FreeBSD 14.0: ||, errno = 0
*/
================================================================================




Reply via email to