计算机里的时钟和定时器 - Clock & Timer
- Hardware Clock
- rtc(4) hwclock(8)
- Software Clock, HZ, jiffies
- HZ = (100, 250, 300, 1000)
- USER_HZ =
sysconf(_SC_CLK_TCK)
- High-Resolution Timer
- clock_getres(2)
cat /proc/timer_list | fgrep resolution
- The Epoch - time since
1970-01-01 00:00:00 +0000 (UTC)gettimeofday(2)- in seconds and microsecondstime(2)- in seconds
- Broken-down time
struct tm
- Sleeping & Timer
sleepnanosleep()clock_nanosleep()alarm()getitimer()timerfd_create()timer_create()
- Timer Slack - allow delay of timer wakeup