The clock_settime() function sets the specified clock, clock_id, to the value specified by tp. Time values that are between two consecutive non-negative integer multiples of the resolution of the specified clock are truncated down
to the smaller multiple of the resolution.
The clock_gettime() function returns the current value tp for the specified clock, clock_id.
The resolution of any clock can be obtained by calling clock_getres(). Clock resolutions are system-dependent and cannot be set by a process. If the argument res is not NULL, the resolution of the specified clock is stored
in the location pointed to by res. If res is NULL, the clock resolution is not returned. If the time argument of clock_settime() is not a multiple of res, then the value is truncated
to a multiple of res.
A clock may be systemwide (that is, visible to all processes) or per-process (measuring time that is meaningful only within a process).
A clock_id of CLOCK_REALTIME is defined in <time.h>. This clock represents the realtime clock for the system. For this clock, the values returned by clock_gettime() and specified
by clock_settime() represent the amount of time (in seconds and nanoseconds) since the Epoch. Additional clocks may also be supported. The interpretation of time values for these clocks is unspecified.
A clock_id of CLOCK_HIGHRES represents the non-adjustable, high-resolution clock for the system. For this clock, the value returned by clock_gettime(3RT) represents the amount of time (in seconds and nanoseconds) since some arbitrary time in the past; it is not correlated in any way to the time of day, and thus is not subject to resetting or drifting by way of adjtime(2), ntp_adjtime(2), settimeofday(3C), or clock_settime(). The time source for this clock is the same as that for gethrtime(3C).
Additional clocks may also be supported. The interpretation of time values for these clocks is unspecified.