Article View: comp.std.c
Article #2154Re: Change to time() fn?
From: Alan J Rosenthal
Date: Tue, 29 Sep 1992 17:48
Date: Tue, 29 Sep 1992 17:48
20 lines
1691 bytes
1691 bytes
karl@ima.isc.com (Karl Heuer) writes: >Unfortunately, in order to allow for implementations that have no clock, the >Standard requires that |time()| be able to return the constant |(time_t)-1| >to indicate failure. Hence, |time_t| must be an arithmetic type. Well, time_t must be a type which can be cast to and from -1. So there's no reason it couldn't be a struct __timeval, with a special case in the compiler, right? The special case would work as follows: If you cast -1 to struct __timeval (which you probably invoke by casting it to time_t), then it yields an external reference to __no_timeval, which is a struct __timeval in the library with all zeroes or whatever's convenient. I don't think you can cast a time_t to int or long or anything like that, but if you could, this cast could turn into ((arg.__errorindicator == 53) ? -1 : 0) or whatever test is appropriate. Finally, we have comparisons: If you compare two time_t's, well perhaps you're allowed to compare them in general, in which case this would have to turn into a full comparison, but otherwise, it could just check whether or not they were both __no_timeval's or both not. Workable?
Technical Details
Message-ID:
<1992Sep29.134807.21457@jarvis.csri.toronto.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!utcsri!csri.toronto.edu!flapsReferences:
<1992Sep29.154252.5453@ima.isc.com> <1992Sep15.042120.27559@nntpd.lkg.dec.com> <1992Sep17.120636.29070@linus.mitre.org> <1992Sep26.153421.7698@cpio1.fr.mugnet.org>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!utcsri!csri.toronto.edu!flaps Newsgroups: comp.std.c From: flaps@csri.toronto.edu (Alan J Rosenthal) Subject: Re: Change to time() fn? Message-ID: <1992Sep29.134807.21457@jarvis.csri.toronto.edu> Organization: Dynamic Graphics Project, University of Toronto References: <1992Sep29.154252.5453@ima.isc.com> <1992Sep15.042120.27559@nntpd.lkg.dec.com> <1992Sep17.120636.29070@linus.mitre.org> <1992Sep26.153421.7698@cpio1.fr.mugnet.org> Date: 29 Sep 92 17:48:07 GMT Lines: 20