mktime() failure vs 31-DEC-1969 23:59:59 GMT

tomp at tomp at
Wed Feb 14 16:26:11 UTC 1996

> Call localtime() on the seemingly-in-error mktime() result, and compare
> the relevant portions of the structs tm.  A match implies a non-error.

This doesn't sound very stable, but perhaps there is no other alternative.
No errors are defined for localtime() either, so we would be assuming that
the tm info it returns is correct.  Of course, we only need to check this
when the return of mktime() is -1, so perhaps the risk/impact is minimal.
However, it might make sense to add documentation to this effect to the
manpage for mktime() so folks don't assume that a -1 return from mktime()
always means that the time specified is not representable.

- Tom

More information about the tz mailing list