C9x <time.h> and clock precision

Markus Kuhn Markus.Kuhn at cl.cam.ac.uk
Wed Oct 7 10:46:23 UTC 1998

Paul Eggert wrote on 1998-10-07 09:01 UTC:
> All that's needed is that the clock had the reported value at some
> time during the invocation of xtime_get().  (Hmm, perhaps the spec
> should say something about this?)

I certainly thought about providing some wording on the required or
recommended relation between the timestamp and the entry/exit time of
the function call, but I couldn't find a satisfactory formulation for
which I didn't see problems. Some operating systems do variable time
operations such as checking signals either before or after each system
call, which make it difficult to get something widely implementable
formulated her.

If you need really precise guaranteed semantics, you probably will have
to read the spec of your system and do it yourself in assembler.
Portablility standards such as ISO C must have great limitations in what
they are allowed to specify here.

>    I am starting to get concerned that I might have wasted a lot of time
>    while working on this, especially since I didn't get any feedback yet
>    from the only ISO C committee member on this list.
> I also hope that your time wasn't wasted, but I don't think that the
> C9x is the only avenue for your work to be exploited.  If we can get
> this into the GNU C library, for example, a lot of users will have it
> available in fairly short order.  This will help convince the ISO C
> committee the next time around.

Once things have cooled down a bit, I'll probably write a paper about
concepts for time APIs in general and might provide something like xtime
(or an Ada version of it) as a discussion example. The heated discussion
here indicates that this certainly is a not yet widely understood
subject that deserves a bit of scientific discussion. And yes, the Linux
kernel and GNU libc are certainly good demo implementation candidates.


Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK
email: mkuhn at acm.org,  home page: <http://www.cl.cam.ac.uk/~mgk25/>

More information about the tz mailing list