POSIX 7 quotes
POSIX 7 specifies both at http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html:
CLOCK_REALTIME
:
This clock represents the clock measuring real time 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.
CLOCK_MONOTONIC
(optional feature):
For this clock, the value returned by clock_gettime() represents the amount of time (in seconds and nanoseconds) since an unspecified point in the past (for example, system start-up time, or the Epoch). This point does not change after system start-up time. The value of the CLOCK_MONOTONIC clock cannot be set via clock_settime().
clock_settime()
gives an important hint: POSIX systems are able to arbitrarily change CLOCK_REALITME
with it, so don't rely on it flowing neither continuously nor forward. NTP could be implemented using clock_settime()
, and could only affect CLOCK_REALITME
.
The Linux kernel implementation seems to take boot time as the epoch for CLOCK_MONOTONIC
: Starting point for CLOCK_MONOTONIC