Returns the current time (in seconds and nanoseconds) for the specified clock. This function is supported on OpenVMS Integrity servers and Alpha only. Format #include <time.h> int clock_gettime (clockid_t clock_id, struct timespec *tp);
1 – Arguments
clock_id The clock type used to obtain the time for the clock that is set. The CLOCK_REALTIME clock is supported and represents the TIME-OF-DAY clock for the system. tp A pointer to a timespec data structure.
2 – Description
The clock_gettime function returns the current tp value for the specified clock, clock_id. On success, the function returns 0. On failure, the function returns -1 and sets errno to indicate the error. See also clock_getres, clock_settime, time, and ctime.
3 – Return Values
0 Indicates success. -1 Indicates failure; errno is set to the following value: o EINVAL - The clock_id argument does not specify a known clock, or the tp argument specifies a nanosecond value less than 0 or greater than or equal to 1 billion.