[tz] strftime %s

Steffen Nurpmeso steffen at sdaoden.eu
Wed Jan 10 19:16:42 UTC 2024


Dag-Erling Smørgrav via tz wrote in
 <86mstdp2nd.fsf at ltc.des.no>:
 |Currently, strftime() implements %s by calling mktime() and then
 |printing the result.  This is fine when the struct tm passed to
 |strftime() came from localtime() but not when it didn't.  A better

Actually the manual page on Linux says

     %s     The number of seconds since the Epoch, 1970‐01‐01 00:00:00 +0000
            (UTC). (TZ) (Calculated from mktime(tm).)

Maybe instead the newstrftime.3 manual should give the same hint?
The POSIX standard does in sofar as it says

  s      Replaced by the number of seconds since the Epoch as
         a decimal number, calculated as described for mktime()

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)



More information about the tz mailing list