mate-desktop / mate-notification-daemon

Daemon to display passive pop-up notifications
https://mate-desktop.org
GNU General Public License v2.0
30 stars 26 forks source link

daemon: Use monotonic time instead of real time #176

Closed rbuj closed 4 years ago

lukefromdc commented 4 years ago

What is monotonic time?

rbuj commented 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.