Tom Peterson (USG) wrote: <from Ken Pizzini>
A problematical situation on any implementation is distinguishing between an error return from mktime() and mktime() returning a legitimate -1 value. [...]
An error code (or errno) would help here I think. If errno were set to a particular value when mktime() really couldn't represent the value, we'd have a way to distinguish between a valid -1 and and error -1 return value.
I agree with you.
Problem is, we'd have trouble getting the standards like X/Open to accept this, since they claim they don't support negative time_t's (ie: times before the Epoch).
Strictly speaking, mktime() is not a X/Open standard, but part of the standard C library. So IMHO, the solution lie more in the realm of ISO/JTC2/SC22/WG14 (the comittee in charge of C standardization) than in X/Open. And BTW, ISO C doesn't put any restriction on the range of the value of the time_t (which is only arithmetical, not necessary [un]signed long int); and Epoch does take any sense as long as ISO C is concerned. Best regards, Antoine