Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
clock_gettime, clock_gettime64 - get time of a specified clock
&pagelevel(4)&pagelevel
Syntax | #include <time.h> int clock_gettime(clockid_t clk_id, struct timespec *tp); int clock_gettime64(clockid_t clk_id, struct timespec64 *tp); |
Description
In the structure which points to tp, clock_gettime()
and clock_gettime64()
supply the
| time of the clock that is pecified by clk_id as the number of seconds and milliseconds which have passed since the reference date (epoch). Only the system-wide real time clock CLOCK_REALTIME is supported. It supplies the number of seconds and nanoseconds which have passed since the reference date (epoch). The reference date is 1/1/1970 00:00:00. |
Return val. | 0 -1 | if successful. if an error occurs. errno is set to indicate the error. |
Error | clock_gettime() will fail, if: EINVAL the specified clk_id is not supported. |
See also | gettimeofday |