1
2CLOCK_NANOSLEEP(2)         Linux Programmer's Guide         CLOCK_NANOSLEEP(2)
3
4
5

NAME

7       clock_nanosleep - Suspend execution of the currently running thread
8

SYNOPSIS

10       long sys_clock_nanosleep (clockid_t which_clock, int flags,
11                                 const struct timespec *rqtp,
12                                 struct timespec *rmtp);
13
14

DESCRIPTION

16       clock_nanosleep  suspends execution of the currently running thread un‐
17       til the time interval specified by rqtp is elapsed, or until the  func‐
18       tion  is  woken  up by a signal. The rmtp is updated with the amount of
19       time remaining in the time interval (requested  minus  sleep  time)  if
20       non-null. If null, the rmtp argument does not return any remaining time
21       information.
22
23
24       The flags parameter specifies the type of behavior the call will  take.
25       So  far,  the  only  value  defined for this parameter (defined in  in‐
26       clude/linux.time.h is TIMER_ABSTIME). This  value  causes  the  current
27       thread to be suspended from execution in three ways:
28
29
30       1. Until  either  the  time  value  of  the clock specified by clock_id
31          reaches the absolute time specified by the rqtp argument.
32
33       2. Until a signal is delivered to the calling thread and its action  is
34          to invoke a signal-catching function.
35
36       3. Until the process is terminated.
37
38       The  values  that clockid_t currently supports for POSIX.1b timers (de‐
39       fined in include/linux/time.h) are:
40
41
42       CLOCK_REALTIME
43              Systemwide realtime clock.
44
45
46       CLOCK_MONOTONIC
47              Represents monotonic time. Cannot be set.
48
49
50       CLOCK_PROCESS_CPUTIME_ID
51              High resolution per-process timer.
52
53
54       CLOCK_THREAD_CPUTIME_ID
55              Thread-specific timer.
56
57
58       CLOCK_REALTIME_HR
59              High resolution version of CLOCK_REALTIME.
60
61
62       CLOCK_MONOTONIC_HR
63              High resolution version of CLOCK_MONOTONIC.
64
65

RETURN VALUE

67       clock_nanosleep returns 0 if the time specified by  rqtp  has  elapsed;
68       otherwise, it returns one of the errors listed in the "Errors" section.
69
70

ERRORS

72       -EINVAL
73              An invalid which_clock value or an invalid rqtp was specified.
74
75
76       -EFAULT
77              The value was could not be copied to the rmtp or an invalid rqtp
78              value was specified.
79
80

SEE ALSO

82       clock_getres(2), clock_gettime(2), clock_settime(2)
83
84

AUTHOR

86       Niki Rahimi
87
88
89
90Linux 2.6                        2004-March-12              CLOCK_NANOSLEEP(2)
Impressum