Functions add/diff/cmp for xtime
Markus.Kuhn at cl.cam.ac.uk
Wed Oct 7 11:21:03 UTC 1998
Antoine Leca wrote on 1998-10-07 10:29 UTC:
> D. J. Bernstein wrote:
> > Markus Kuhn writes:
> > > If you are *really* interested in the number of SI seconds between two
> > > UTC timestamps (very few applications will really need this,
> But they *are* applications that need it, right?
Sure there are. But *much* fewer than some people here tend to think.
You need something like TAI to get correct SI second intervals across
reboots of systems where TIME_MONOTONIC is not preserved. You certainly
need TAI to control astronomical instruments and time astronomical or
geophysical observations, or navigate spacecraft. You need TAI as Dan
pointed out for some types of accounting (although you really should
first investigate the details here before you just assume that charging
for leap seconds is what really what is desired).
> The only reasonable solution is to have the option.
> Currently, the only API which gives me the choice one way
> or another is Markus', provided that every struct xtime
> parameter may be tagged with the information whether it
> is really TIME_TAI *or* TIME_UTC (as defined by Markus,
> with the added point that the calendar should be the
> proleptic Gregorian).
Note that there is no reason for the tagging to show up in the bits of
the value. The tagging can be done implicitly by naming your variables
in software such that they make clear whether they are intended for UTC
or TAI or whatever values. If you want to do this more formally, then in
languages like Ada you have powerful subtyping mechanisms that allow you
to build APIs that make it unlikely that programmers will accidentally
mix UTC and TAI values in an inappropriate way. For this, you would
of course have overloaded versions of xtime.get.
Question: What precisely does "proleptic" mean and where is it defined.
The most official definition of the Gregorian calendar that I have to
reference is ISO 8601, and it does not use the term "proleptic". My time
and astronomy references to not define the term either. (I suspect it
means "extended before the time it was defined", but would like to get a
confirmation and reference.)
Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK
email: mkuhn at acm.org, home page: <http://www.cl.cam.ac.uk/~mgk25/>
More information about the tz