On some systems it might be preferable to use e.g. CLOCK_BOOTTIME instead of CLOCK_MONOTONIC, which is also not affected by time adjustments but includes times when the system was suspended.