Skip to content
Theory · Unique ID generator · lesson 7 of 10

When the clock goes back

The generator takes the timestamp from its host's clock, and that clock is not perfect. It drifts, NTP corrects it, and after a correction it can land in the past. For most programs a step of a few milliseconds goes unnoticed. For an ID generator it is a straight road to a duplicate, and the interviewer almost always asks what the generator does at that moment.

In this lesson

  • How a step back makes a duplicate
  • Three ways and their cost
  • Restarts and someone else's number
  • How far from time order
  • What an ID reveals
  • Common mistake
  • Key points