Bruno Haible via GNU coreutils General Discussion <[email protected]>
writes:

> The CI reports that the date/date-tz test fails on FreeBSD, NetBSD, OpenBSD.
>
> On FreeBSD:
>
> FAIL: tests/date/date-tz
> ========================
>
> Mon Jun 15 20:17:00 UTC 2026
> --- exp       2026-06-15 21:48:53.793131000 +0000
> +++ out       2026-06-15 21:48:53.793024000 +0000
> @@ -1 +1 @@
> -2024-10-27T02:30:00+0100
> +2024-10-27T02:30:00+0200
> FAIL tests/date/date-tz.sh (exit status: 1)

That is a recently added test here:

    # An ambiguous local time in the fall-back overlap takes the earlier,
    # still-DST offset (+0100 here, not +0200).
    TZ=Europe/Paris date -d '2024-10-27 02:30:00' '+%Y-%m-%dT%T%z' > out || 
fail=1
    printf "2024-10-27T02:30:00+0100\n" > exp || framework_failure_
    compare exp out || fail=1

It looks like %z behaves strangely on BSD. Using the following test
program:

    $ cat main.c 
    #include <time.h>
    #include <stdio.h>
    #include <stdlib.h>
    int
    main (void)
    {
      tzset();
      time_t t = 1729992600;
      struct tm tm;
      gmtime_r (&t, &tm);
      char buf[256];
      strftime (buf, sizeof buf, "%z", &tm);
      printf ("tm_gmtoff: %d\n", tm.tm_gmtoff);
      printf ("tm_isdst:  %d\n", tm.tm_isdst);
      puts (buf);
      return EXIT_SUCCESS;
    }

On GNU/Linux:

    $ gcc main.c; TZ=Europe/Paris ./a.out
    tm_gmtoff: 0
    tm_isdst:  0
    +0000

On NetBSD:

   $ gcc main.c; TZ=Europe/Paris ./a.out
   tm_gmtoff: 0
   tm_isdst:  0
   +0100

Paul, what do you think? This feels like a bug in BSD to me, but I
certainly trust your opinion here more than mine.

Collin

Reply via email to