time since the epoch
Stefan Karrmann
sk@mathematik.uni-ulm.de
Thu, 6 Feb 2003 20:05:39 +0100
Keith Wansbrough (Thu, Feb 06, 2003 at 05:46:22PM +0000):
> Stefan Karrmann <sk@mathematik.uni-ulm.de> writes:
>
> > A sound base for a Time implementation should use TAI (temps atomique
> > international), c.f. <http://cr.yp.to/libtai.html>.
>
> I disagree; I think UTC is quite sufficient, and will match the users'
> expectations much better. (executive summary: UTC is the time on your
> watch (+/- timezone of course), TAI is behind by a few seconds, and
> this difference changes each time there's a new leap second).
>
> However, the reference above is not to TAI, but to a library called
> libtai. I don't know anything about this; Stefan, maybe you could
> tell us some more?
One TAI second is defined as the duration of 9192631770 periods of the
radiation corresponding to the transition between the two hyperfine
levels of the ground state of the cesium atom (quoted from
<http://cr.yp.to/libtai/tai64.html>). Therefore, it is easy to add
seconds to a TAI-label. If you have a leap-second table, you can
easily convert TAI into UTC but not visa-versa (afaik), since in UTC
leap-seconds are mapped to the previous second! (You need a leap-flag.)
>From UTC to CalenderTime (Gregorian (from 1582) or ISO time) is
straight forward.
Libtai is a public domain implementation of 64-bit TAI-labels, which
are defined from 1E+11 years before 1970 to 1E+11 years after 1970.
Thus this would avoid year 2038 and 2036 bugs of other common time
representations.
References (some may moved into nirwana):
1. <http://www.boulder.nist.gov/timefreq/general/glossary3.htm>
2. <http://www.boulder.nist.gov/timefreq/pubs/bulletin/leapsecond.htm>
3. <http://sadira.gb.nrao.edu/~rfisher/Ephemerides/times.html>
4. <http://purl.org/DC/elements/1.1/>
Sincerly,
--
Stefan Karrmann