[tz] mktime() clarification

Dag-Erling Smørgrav des at des.no
Mon Mar 25 19:41:23 UTC 2024


"Clive D.W. Feather via tz" <tz at iana.org> writes:
> Dag-Erling Smørgrav <des at des.no> writes:
> > [...] POSIX never guarantees that a successful call does not modify
> > errno [...]
> Library functions and system calls never set errno to 0. So the usual
> answer is to set errno to 0 before the call and see if it's still 0
> afterwards.

See above, and try this:

    struct tm tm = { .tm_mday = 1, .tm_year = 69 };
    errno = 0;
    printf("%ld %d\n", mktime(&tm), errno);

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the tz mailing list