C9x <time.h> and clock precision
eggert at twinsun.com
Wed Oct 7 22:58:38 UTC 1998
Date: Wed, 07 Oct 1998 11:35:13 +0100
From: Markus Kuhn <Markus.Kuhn at cl.cam.ac.uk>
Paul Eggert wrote on 1998-10-07 09:01 UTC:
> I would
> like the spec to be modified so that xtime_get(TIME_MONOTONIC) can be
> compiled to a single instruction accessing the hardware clock
> register directly, which will make sub-ns access more practical.
Don't forget that the old clock_t clock(void); is still available
It's available, but it wouldn't work well, for three reasons.
First, `clock' reports the sum of the CPU times of the process and its
children; this is not the same as TIME_MONOTONIC. Many applications
need high-precision real-time clocks, not CPU-time clocks.
Second, on my host (Solaris 2.6) `clock' is already defined to return a
32-bit microsecond counter, and it will be inconvenient to change this
to a 64-bit or larger counter, due to backward compatibility concerns.
Third, the struct xtime spec deprecates both clock_t and `clock'. One
of the goals of struct xtime -- a goal that I agree with -- is to
More information about the tz