Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aEJf6opxxprdzizc@voyager>
Date: Fri, 6 Jun 2025 05:26:34 +0200
From: Markus Wichmann <nullplan@....net>
To: musl@...ts.openwall.com
Cc: David Steele <david@...ackrest.org>
Subject: Re: Possible issue formatting epoch time with strftime()

Am Thu, Jun 05, 2025 at 05:45:37PM -0400 schrieb Rich Felker:
> If it's non-conforming now it should be fixed. Is the new requirement
> that %s treat the broken-down time as if it were in local time?

That's my reading of the spec. POSIX-2024 defines %s as:
| Replaced by the number of seconds since the Epoch as a decimal number,
| calculated as described for mktime(). 

And mktime() is described as adjusting the timestamp to local time at
the end.

> Does
> this create a new requirement that strftime behave as if it calls
> tzset, and thereby a new environment dependency (and rule for when
> it's safe to modify the environment), and is this addressed in the
> standard?
> 

Yes, POSIX-2024 says that strftime() should call tzset().

Note that POSIX-2024 also standardized tm_gmtoff and tm_zone, and uses
those for %z and %Z, so it is not all timestamps that need to be treated
as local time. Actually, POSIX leaves that one unspecified.


Ciao,
Markus

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.