timespec_get(3) Library Functions Manual timespec_get(3) timespec_get, timespec_getres - ISO C (libc -lc) #include int timespec_get(struct timespec *res, int base); int timespec_getres(struct timespec *tp, int base); glibc ( feature_test_macros(7)): timespec_get() TIME_UTC: _ISOC11_SOURCE timespec_getres() TIME_MONOTONIC TIME_ACTIVE TIME_THREAD_ACTIVE: _ISOC23_SOURCE timespec_get() timespec(3type) res. timespec_getres() timespec_get() timespec(3type) tp tp NULL. . base : TIME_UTC ( ). clock_gettime(CLOCK_REALTIME, res) clock_getres(CLOCK_REALTIME, tp) . TIME_MONOTONIC . clock_gettime(CLOCK_MONOTONIC, res) clock_getres(CLOCK_MONOTONIC, tp) . TIME_ACTIVE . clock_gettime(CLOCK_PROCESS_CPUTIME_ID, res) clock_getres(CLOCK_PROCESS_CPUTIME_ID, tp) . TIME_THREAD_ACTIVE . clock_gettime(CLOCK_THREAD_CPUTIME_ID, res) clock_getres(CLOCK_THREAD_CPUTIME_ID, tp) . timespec_get() base 0 . timespec_getres() base 0 . attributes(7). +------------+------------------------------------+--------------------+ || | | +------------+------------------------------------+--------------------+ |timespec_get()| | MT-Safe | |timespec_getres()| | | +------------+------------------------------------+--------------------+ timespec_get() C23 POSIX.1-2024. TIME_UTC C23 ( ISO C ) POSIX.1-2024. timespec_getres() TIME_MONOTONIC TIME_ACTIVE TIME_THREAD_ACTIVE C23. timespec_get() TIME_UTC C11 POSIX.1-2024 glibc 2.16 musl 1.1.10. timespec_getres() C23 glibc 2.34. TIME_MONOTONIC TIME_ACTIVE TIME_THREAD_ACTIVE C23 glibc 2.43. clock_gettime(2) clock_getres(2) 3 . . : . 6.18 11 2026 timespec_get(3)