TRT
Sign in

Core · Module 5 · Lesson 12 of 12

Clocks, Timers, and Timeouts

Choose the right POSIX clock, measure elapsed time monotonically, and design deadlines that remain correct across interruptions.

Pro — members onlyAbout 15 minutes

By the end you can

  • Distinguish wall-clock time from monotonic elapsed time
  • Build deadlines from clock readings
  • Avoid extending a timeout after EINTR
  • Select timer mechanisms for blocking and periodic work

Builds on System Call Errors, errno, and EINTR.

01 · A question first

If the system clock is adjusted backward while a request is waiting, should a five-second timeout become longer? Reliable systems separate calendar time from elapsed time.

Make a guess before you read on.

02 · The idea

Members only

Unlock the full lesson

This lesson is part of the membership. Join to read it in full, along with every other premium deep dive.

What's inside

  • Start with the problem
  • Wall-clock time and monotonic time
  • Use absolute deadlines
  • Sleep, poll, and timers
  • What it costs
  • Pitfalls and variations
  • Where it is used
  • Operational checklist

Something wrong with this lesson? Report a problem