clock_nanosleep(2) System Calls Manual clock_nanosleep(2) clock_nanosleep - LIBRARY Standard C library (libc, -lc), since glibc 2.17 Before glibc 2.17, Real-time library (librt, -lrt) #include int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *request, struct timespec *_Nullable remain); glibc (. feature_test_macros(7)): clock_nanosleep(): _POSIX_C_SOURCE >= 200112L nanosleep(2), clock_nanosleep() . , , , . The time values passed to and returned by this call are specified using timespec(3) structures. clockid , . : CLOCK_REALTIME . CLOCK_TAI ( Linux 3.10) A system-wide clock derived from wall-clock time but counting leap seconds. CLOCK_MONOTONIC , , , . CLOCK_BOOTTIME ( Linux 2.6.39) Identical to CLOCK_MONOTONIC, except that it also includes any time that the system is suspended. CLOCK_PROCESS_CPUTIME_ID , , . clock_getres(2). ID , clock_getcpuclockid(3) pthread_getcpuclockid(3), clockid. flags 0, , request, , clockid. flags TIMER_ABSTIME, request , , clockid. request , clock_nanosleep() . clock_nanosleep() , , request, , , . , clock_nanosleep() EINTR. , remain NULL flags TIMER_ABSTIME, remain . clock_nanosleep() () . , clock_nanosleep() 0. , , . EFAULT request remain . EINTR ; signal(7). EINVAL The value in the tv_nsec field was not in the range [0, 999999999] or tv_sec was negative. EINVAL clockid. ( CLOCK_THREAD_CPUTIME_ID clockid.) ENOTSUP The kernel does not support sleeping against this clockid. POSIX.1-2008. POSIX.1-2001. Linux 2.6, glibc 2.1. , request, (. time(7)), . , , . , nanosleep(2). ( , .) , clock_gettime(2) , clock_nanosleep() TIMER_ABSTIME. clock_nanosleep() , , SA_RESTART sigaction(2). remain , flags TIMER_ABSTIME. ( request.) POSIX.1 , clock_nanosleep() . POSIX.1 , CLOCK_REALTIME clock_settime(2), , clock_nanosleep() ; , clock_nanosleep() . POSIX.1 , CLOCK_REALTIME clock_settime(2) , clock_nanosleep() . . clock_getres(2), nanosleep(2), restart_syscall(2), timer_create(2), sleep(3), timespec(3), usleep(3), time(7) Azamat Hackimov , Dmitriy S. Seregin , Dmitry Bolkhovskikh , Katrin Kutepova , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 11 2023 . clock_nanosleep(2)