[tz] Buggy %z behaviour in strftime

Almaz Mingaleev mingaleev at google.com
Mon Jul 18 09:34:33 UTC 2022

Setting tm_gmtoff "fixes" it. Should I call mktime before
passing tm struct into strftime? Or assumption here is
"garbage in - garbage out"?
It was unexpected to me and it is not clear from man pages.
Also, as strftime has no way of indicating error [1], is
there any downside of "doing the right thing" (tm) and
instead of using user provided tm_gmtoff get it from mktime

Yep, there is tm_gmtoff in MacOs. Moreover, its strftime
implementation ignores any garbage value stored there
and puts the correct value into the passed array.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html

On Mon, 18 Jul 2022 at 10:04, Guy Harris via tz <tz at iana.org> wrote:

> On Jul 18, 2022, at 1:44 AM, Andreas Schwab via tz <tz at iana.org> wrote:
> > You are not setting tm_gmtoff, thus it remains at zero.  MacOS probably
> > doesn't have tm_gmtoff.
> Given that it's derived from, among other sources, various
> 4.4-Lite-derived BSDs, macOS most definitely *does* have tm_gmtoff.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mm.icann.org/pipermail/tz/attachments/20220718/4f8f8da2/attachment.htm>

More information about the tz mailing list