time.h design issues
D. J. Bernstein
djb at cr.yp.to
Sun Aug 29 23:18:53 UTC 1999
I agree that there are programs that use a low-level tick counter. One
obvious example is the operating system: there's no reasonable way to
implement gettimeofday(), for example, without a low-level tick counter.
I also agree that toasters and other memoryless real-time embedded
systems, being constitutionally incapable of figuring out the current
time, need to use low-level tick counters instead.
However, treating low-level tick counters the same way as timestamps is
a blatant error. Old timestamps have a defined relationship to civil
time; old tick counters do not. Most time functions simply don't make
sense for tick counters. The fact that something is changing over time
doesn't mean that it belongs in a time library!
Furthermore, it is clearly incorrect to claim that tick counters
eliminate the problems of setting clocks backwards. I already gave the
example of the ``make'' program; if you use tick counters here instead
of timestamps, you get disastrous results after a reboot.
---Dan
More information about the tz
mailing list