3 ms·
That the clock always moves forward. As one example, some clocks are cpu specific (rather than system specific). When a thread gets scheduled to a different cp
by calanya 10y ago
That the clock always moves forward.
As one example, some clocks are cpu specific (rather than system specific). When a thread gets scheduled to a different cpu, it might be talking to a different clock, and getting a backwards time.
The user might also be changing the clock while the program is running, of course.
If the forward direction of time is important, make sure the the source of time is a monotonic clock API.
- saretired 10y agoAll I can add is a warning about running NTP if you are maintaining a priority queue of time-stamped actions (now + delta, where delta depends on the action): use CLOCK_MONOTONIC instead of wall time.