[tz] strftime %s

Paul Gilmartin PaulGBoulder at AIM.com
Wed Jan 10 21:27:41 UTC 2024


On 1/10/24 12:20:38, Paul Eggert via tz wrote:

>     ...
> Perhaps a better approach would be for tzcode to implement strftime_z a la NetBSD. That way, you could tell strftime_z that the struct tm came from gmtime. See:
> 
> https://man.netbsd.org/strftime_z.3
> 
> I vaguely recall thinking that strftime_z wasn't needed and therefore omitting it from tzcode, but your example suggests otherwise.
> .
It's unduly complex, even inconsistent if
     strftime( "%s" )
does not yield the same result as
     sprintf( "%d", mktime( ... ) )
similarly taking into account the implied tzset(), TZ, etc.

Seconds since the epoch should not depend on TZ.  The epoch
is 0 UTC, not 0 local.  But the programmer must make TZ
consistent with the members of struct tm.

-- 
gil



More information about the tz mailing list