[tz] strftime %s

Robert Elz kre at munnari.OZ.AU
Fri Jan 12 19:11:05 UTC 2024


    Date:        Fri, 12 Jan 2024 07:50:51 -0700
    From:        Paul Gilmartin via tz <tz at iana.org>
    Message-ID:  <c7dfdd7d-0924-4c79-856f-320c6dad3e6f at AIM.com>

  | 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.

I know.

  | 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.

I know that too, which is what I think I said, or at least, implied.

Still non-trivial to use printf on a time_t without a PRIxxx designed
for time_t use - really need to cast the time_t arg to intmax_t and
use %jd which is a bit ugly.

kre




More information about the tz mailing list