[tz] mktime() clarification

Steve Summit scs at eskimo.com
Tue Mar 26 01:35:44 UTC 2024


Dag-Erling Smørgrav wrote:
> Both the C standard and POSIX state that mktime() returns -1 on failure;
> POSIX additionally states that it sets errno.  However, since -1 is also
> a valid result (representing 23:59:59 UTC on 1969-12-31) and POSIX never
> guarantees that a successful call does not modify errno, it seems to me
> that the only reliable way to determine whether mktime() succeeded...

I could be wrong, but I have the impression that there are or
have been a very few library functions over the years that *did*
guarantee not to modify errno on success.  I wish mktime was or
could be made one of them -- that would seem to be an ideal way
to resolve the return value ambiguity here.


More information about the tz mailing list