int clock_gettime (
struct timespec *tp);
int clock_settime (
const struct timespec *tp);
The clock_gettime function returns the current time (in seconds and nanoseconds) for the specified clock. The clock_settime function sets the specified clock. The CLOCK_REALTIME clock measures the amount of time elapsed since 00:00:00:00 January 1, 1970 Greenwich Mean Time (GMT), otherwise known as the Epoch. Time values that fall between two non-negative integer multiples of the resolution are truncated down to the smaller multiple of the resolution.
You must have superuser privileges to use the clock_settime function.
On a successful call to the clock_gettime or clock_settime functions, a value of 0 is returned.
On an unsuccessful call, a value of -1 is returned and errno is set to indicate that an error occurred.
The clock_gettime, and clock_settime, functions fail under the following conditions:
The value pointed to by the tp argument to the clock_settime function is outside the range for the given clock_id.
The tp argument specified a nanosecond value less than zero or greater than or equal to 1000 million.
Functions: time(1), clock_getres(3), ctime(3), timer_gettime(3) delim off