CLOCK_MONOTONIC
never experiences discontinuities due to NTP time adjustments, but it does change in frequency as NTP learns what error exists between the local oscillator and the upstream servers.
CLOCK_MONOTONIC_RAW
is simply the local oscillator, not disciplined by NTP. This could be very useful if you want to implement some other time synchronization algorithm against a clock which is not fighting you due to NTP. While ntpd (the reference implementation of NTP protocol and the most widespread NTP daemon) is reputed to be “gentle” with time adjustments, it’s more accurate to say it’s gentle with the absolute time. It’s willing to slew the clock by 500ppm which is pretty dramatic if you’re in a position to measure your clock frequency against some other standard.
The utility of CLOCK_MONOTONIC_RAW
is going to be limited until facilities like pthread_timedwait_monotonic
offer an option to use that timebase.