clock_settime, clock_gettime, clock_getres - high-resolution clock operations
#include <time.h>
clock_settime() sets the specified clock, clock_id, to the value specified by tp.
clock_gettime() returns the current value tp for the specified clock, clock_id.
The resolution of any clock can be obtained by calling clock_getres(). If res is not NULL, the resolution of the specified clock is stored in res.
The clock_id for the real-time clock for the system is CLOCK_REALTIME. The values returned by clock_gettime() and specified by clock_settime() represent the amount of time (in seconds and nanoseconds) since 00:00 Universal Coordinated Time, January 1, 1970.
The clock_id for the momotonic clock for the system is CLOCK_MONOTONIC. The values returned by clock_gettime() represents the amount of time (in seconds and nanoseconds) since system start-up time. The value of the CLOCK_MONOTONIC clock cannot be set via clock_settime().
clock_settime(), clock_gettime(), and clock_getres() return 0 upon success, otherwise they return -1 and set errno to indicate the error condition.
By default, the clock starts at 00:00:00 unless clock_settime() is called.