3 ms·
On the "smash head here" moment: This distinction is called a steady clock, which is stricter than a monotonic clock in the way that it should never stop. On th
by lifthrasiir 4y ago
On the "smash head here" moment: This distinction is called a steady clock, which is stricter than a monotonic clock in the way that it should never stop. On the other hand a monotonic clock can be made from a non-monotonic clock by detecting clamping any timestamp to the biggest observed value; this will be less useful if, for example, the clock source is ever decreasing.
In reality there is no absolute way to guarantee that a particular clock source is steady; virtualization can easily wreck them, so an external verification is the only definitive solution. You can say that macOS `CLOCK_MONOTONIC` is more steady than Linux `CLOCK_MONOTONIC`, but you can never assume they are actually steady all the time; they are only steady enough for not causing issues in typical cases.
- hawk_ 4y agoBTW on linux the equivalent is CLOCK_BOOTTIME - and the general point stands that you need to find something "steady" enough for your usecase. There is no absolutely monotonic clock in the universe ;-), that we know of, is there?