the ``need'' for POSIX times
D. J. Bernstein
djb at cr.yp.to
Fri Oct 9 19:59:09 UTC 1998
Markus Kuhn writes:
> (Wait, so must be POSIX and BSD then, on which my proposal is *very*
> closely modeled after all ...)
Don't try to blame BSD for your mistakes.
To record a BSD timestamp I can simply call gettimeofday(). The code
will never fail. The difference between two timestamps is always an
excellent approximation to the real time difference---as long as the
machine is _not_ running xntpd.
Your API does not have a sane replacement for gettimeofday().
> a lot of algebraic properites are nicely preserved by
> xtime_add and xtime_diff.
Don't be silly. For your notion of ``subtraction'' it isn't true that
(a-b)+b=a, for example, or that a-b<a when b>0.
> With xtime, the programmer simply says what she means:
> #define DAY 86400.0
> t = xtime_add(t, 7*DAY);
> In Ada (a language with strong typing and full operator overloading),
[ blah, blah, blah ]
Brilliant. Now show us your definitions of MONTH and YEAR.
> I also do not have to
> define an equivalent of mktime() with overflow rules
People also do not have to use your library.
1000 recipients, 28.8 modem, 10 seconds. http://pobox.com/~djb/qmail/mini.html
More information about the tz