[tz] Buggy %z behaviour in strftime

Robert Elz kre at munnari.OZ.AU
Mon Jul 18 17:30:56 UTC 2022


    Date:        Mon, 18 Jul 2022 09:03:11 -0700
    From:        Paul Eggert via tz <tz at iana.org>
    Message-ID:  <3c04acad-382b-66d2-e16a-97b69643d3dd at cs.ucla.edu>

  | Good point, and POSIX and the C standard are both wrong here.

They're wrong.   But not (as things stand) not there.

The standards (at least POSIX) treat a timezone (TZ) as

	stdoffset[dst[offset][,start[/time],end[/time]]]

(which does not represent well in plain ascii).   At most two
offsets, one for standard time, one for summer time.   The same
for all years, the only variation is which of the two applies now.

The alternate form with a leading : is implementation defined, and
so nothing more can be said about that.

So, tm_isdst is all that is ever need to select one of those.

The problem is that that is a hopelessly inept view of how a timezone
really behaves - but that's at a whole other level than the specification
of strftime("%z") which just follows from this definition.

kre



More information about the tz mailing list