How can I get microsecond resolution from gettimeofday(2)?
Normally, Digital UNIX updates its internal idea of the
current time once per clock tick (1024 Hz, or about once per
millisecond). In Digital UNIX V4.0 and later, it is possible
to rebuild the kernel to support approximately microsecond
resolution from the gettimeofday(2) system call, and from the
various library routines that use this system call.
To enable this option, add the following line to the kernel
configuration file and rebuild the kernel:
The system clock (CLOCK_REALTIME) resolution as returned by
clock_getres(3) will not change. Timer resolution remains the same.
However, the granularity of the time returned by gettimeofday(2) and
clock_gettime(3) will now be in microseconds. The time values returned
are SMP safe and monotonically increasing.
The high-resolution clock can be used for timestamping and for
measuring durations on the order of microseconds, such as time spent in
some critical code path.