Use the pthread_condattr_setclock(3C) function to set the clock attribute in an initialized attributes object referenced by attr. If pthread_condattr_setclock() is called with a clock_id argument that refers to a CPU-time clock, the call fails. The clock attribute is the clock ID of the clock that is used to measure the timeout service of pthread_cond_timedwait(). The default value of the clock attribute refers to the system clock, CLOCK_REALTIME. At this time, the only other possible value for the clock attribute is CLOCK_MONOTONIC.
int pthread_condattr_setclock(pthread_condattr_t attr, clockid_t clock_id);
#include <pthread.h> pthread_condattr_t attr clockid_t clock_id int ret ret = pthread_condattr_setclock(&attr &clock_id
pthread_condattr_setclock() returns zero after completing successfully. Any other return value indicates that an error occurred. When the following condition occurs, the function fails and returns the corresponding value.
The value specified by clock_id does not refer to a known clock, or is a CPU-time clock.