Subject: Re: Avoiding microtime(9) global state
To: Erik E. Fair <email@example.com>
From: Bill Sommerfeld <firstname.lastname@example.org>
Date: 06/30/2004 16:49:44
> NetBSD should provide both facilities (ToD & interval time), and the
> code we write needs to be clear about which it is using and why.
indeed. as another example, solaris's clock_gettime(3RT) supports
CLOCK_REALTIME (wall clock ToD) and CLOCK_HIGHRES (interval time).
the latter is not adjusted by adjtime or settimeofday or the like.
Internally to the solaris kernel, you can also get high res timestamps
in an internal timebase which doesn't require conversion to
nanoseconds. (solaris synchronizes the underlying cycle/etc counters
between cpus to minimize the amount of locking required to get a
high-resolution interval timestamp).
A third "timebase" of sorts is required by systems which use
timestamp-based unique-id generators (including multics, apollo
domain/os, DCE, and others; the DCE UUID has escaped as the M$ GUID
but i'm not sure if those are time-based as well). This requires that
no two calls to the "gettime" function ever return the same value.
At least some ports of BSD in the 4.2/4.3 timeframe implemented this
property as part of microtime().