clock_nanosleep suspends execution of the currently running thread until the time interval specified by rqtp is elapsed, or until the function is woken up by a signal. The rmtp is updated with the amount of time remaining in the time interval (requested minus sleep time) if non-null. If null, the rmtp argument does not return any remaining time information.
The flags parameter specifies the type of behavior the call will take. So far, the only value defined for this parameter (defined in include/linux.time.h is TIMER_ABSTIME). This value causes the current thread to be suspended from execution in three ways:
- 1.
-
Until either the time value of the clock specified by clock_id reaches the absolute time specified by the rqtp argument.
- 2.
-
Until a signal is delivered to the calling thread and its action is to invoke a signal-catching function.
- 3.
-
Until the process is terminated.
The values that clockid_t currently supports for POSIX.1b timers (defined in include/linux/time.h) are:
- CLOCK_REALTIME
-
Systemwide realtime clock.
- CLOCK_MONOTONIC
-
Represents monotonic time. Cannot be set.
- CLOCK_PROCESS_CPUTIME_ID
-
High resolution per-process timer.
- CLOCK_THREAD_CPUTIME_ID
-
Thread-specific timer.
- CLOCK_REALTIME_HR
-
High resolution version of CLOCK_REALTIME.
- CLOCK_MONOTONIC_HR
-
High resolution version of CLOCK_MONOTONIC.