C Code for draft-newman-datetime-00.txt

Tom Peterson (USG) tomp at zk3.dec.com
Thu Jan 16 14:28:07 UTC 1997

> > > ¤ Comparing t with 0 doesn't take any sense (I know one system where
> > > ¤ (time_t)0 is J2000,0, so negative t are allowed before 2000-01-01 12:00:00Z
> > 
> > Ok, you are right. I just hope that the system you know does not encode
> > 
> >   2000-01-01 11:59:59Z = (time_t) -1
> > 
> > as this value is reserved by the standard for error conditions.
> A problematical situation on any implementation is distinguishing
> between an error return from mktime() and mktime() returning a
> legitimate -1 value.  Another unpleasantness of the API.  But this
> is the only place besides time() where the C standard has a function
> returning a time_t, and time() is not defined to have an error return.

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

- Tom

More information about the tz mailing list