Closed rbuj closed 4 years ago
The monotonic time is measured by CLOCK_MONOTONIC, which has no continuity jumps. On Linux, the CLOCK_MONOTONIC starts at system boot time but stops during suspend, useful for reliable timestamps and measuring short time intervals accurately.
The real time is measured by CLOCK_REALTIME, the time relative to the UNIX epoch starting in 1970 using the Coordinated Universal Time (UTC), same as gettimeofday() user space. This is used for all timestamps that need to persist across a reboot, like inode times, but should be avoided for internal uses, since it can jump backwards due to a leap second update, NTP adjustment settimeofday() operation from user space.
What is monotonic time?