1
2CLOCK_GETTIME(2) Linux Programmer's Manual CLOCK_GETTIME(2)
3
4
5
7 clock_gettime - Return the current timespec value of tp for the speciā
8 fied clock
9
11 long sys_clock_gettime (clockid_t which_clock, struct timespec *tp);
12
13
15 clock_gettime returns the current timespec value of tp for the specific
16 clock, which_clock. The values that clockid_t currently supports for
17 POSIX.1b timers, as defined in include/linux/time.h, are:
18
19
20 CLOCK_REALTIME
21 Systemwide realtime clock.
22
23
24 CLOCK_MONOTONIC
25 Represents monotonic time. Cannot be set.
26
27
28 CLOCK_PROCESS_CPUTIME_ID
29 High resolution per-process timer.
30
31
32 CLOCK_THREAD_CPUTIME_ID
33 Thread-specific timer.
34
35
36 CLOCK_REALTIME_HR
37 High resolution version of CLOCK_REALTIME.
38
39
40 CLOCK_MONOTONIC_HR
41 High resolution version of CLOCK_MONOTONIC.
42
43
44
46 clock_gettime returns 0 on success; otherwise, it returns one of the
47 errors listed in the "Errors" section.
48
49
51 -EINVAL
52 An invalid which_clock value was specified.
53
54
55 -EFAULT
56 Can not coy to tp value.
57
58
60 clock_getres(2), clock_nanosleep(2), clock_settime(2)
61
62
64 Niki Rahimi
65
66
67
68Linux 2.6 2004-March-12 CLOCK_GETTIME(2)