gethrtime, gethrvtime - get high resolution time
SCL Miscellaneous Library (libsolmisc.so, libsolmisc.a)
The gethrtime() function returns the current value of real time in
nanosecond units. The returned value is not necessarily based on the
actual time of day. The function can be used to measure the amount of
real time elapsed between successive calls.
The gethrvtime() function returns a value of accumulated CPU (virtual)
time in nanosecond units for the current process. The children of the
process are not accounted for. This value is only returned if micro-
state accounting is enabled with the ptime(1scl) utility.
SCL IMPLEMENTATION NOTES
On Solaris, the duration measured between successive gethrtime() func‐
tion calls is not affected by changes to the system time. The SCL
implementation is affected by this, therefore care should be taken to
ensure that the clock is not adjusted when applications using this
function are executing, otherwise false measurements may occur.
Although the returned value is in units of nanoseconds, the actual res‐
olution of the value is hardware dependent. The returned time value is
guaranteed to be monotonic (it will not go backward or periodically
wrap), but two successive calls to the function could return the same
Both functions return a time value as a 64-bit signed integer.
Manual: Solaris Compatibility Library User's Guide