1gethrtime(9F) Kernel Functions for Drivers gethrtime(9F)
2
3
4
6 gethrtime - get high resolution time
7
9 #include <sys/time.h>
10
11
12
13 hrtime_t gethrtime(void);
14
15
17 The gethrtime() function returns the current high-resolution real time.
18 Time is expressed as nanoseconds since some arbitrary time in the past;
19 it is not correlated in any way to the time of day, and thus is not
20 subject to resetting or drifting by way of adjtime(2) or settimeof‐
21 day(3C). The hi-res timer is ideally suited to performance measurement
22 tasks, where cheap, accurate interval timing is required.
23
25 gethrtime() always returns the current high-resolution real time. There
26 are no error conditions.
27
29 There are no restrictions on the context from which gethrtime() can be
30 called.
31
33 proc(1), gettimeofday(3C), settimeofday(3C), attributes(5)
34
36 Although the units of hi-res time are always the same (nanoseconds),
37 the actual resolution is hardware dependent. Hi-res time is guaranteed
38 to be monotonic (it does not go backward, it does not periodically
39 wrap) and linear (it does not occasionally speed up or slow down for
40 adjustment, as the time of day can), but not necessarily unique: two
41 sufficiently proximate calls might return the same value.
42
43
44 The time base used for this function is the same as that for geth‐
45 rtime(3C). Values returned by both of these functions can be inter‐
46 leaved for comparison purposes.
47
48
49
50SunOS 5.11 2 Oct 2007 gethrtime(9F)