[tz] strftime %s

Paul Gilmartin PaulGBoulder at AIM.com
Fri Jan 12 14:50:51 UTC 2024


On 1/12/24 01:02:10, Robert Elz via tz wrote:
>      Date:        Thu, 11 Jan 2024 12:28:54 -0800
>      From:        Paul Eggert via tz <tz at iana.org>
>      Message-ID:  <45af6b1e-4bc8-4b8e-86f5-101046061434 at cs.ucla.edu>
> 
>    | It's easy to generate the equivalent
>    | of %s with sprintf on the corresponding time_t value,
> 
> That's true for C code, %s is mostly used with date +%s which doesn't
> need the modified strftime_*() functions (though I don't believe there's
> a standard PRIxxx macro for time_t).
>  .
The OP was concerned with the effect of calling strftime(%s) with
a struct tm that was not generated by localtime() with the same
TZ in the environment.  That doesn't happen with date +format or
with well-designed C code which can call sprintf with the time_t
used to generate the struct tm.

-- 
gil



More information about the tz mailing list