[LEAPSECS] Lets get REAL about time.
Tom Van Baak
tvb at LeapSecond.com
Mon Jan 23 00:53:37 EST 2012
>> libc will need an updated table of leap-seconds to give you UTC,
>> and if you hand it a timestamp that is more than some set delta-T
>> from the last entry in the leapsecond table, it will return E2BIG
>> rather than give you a potentially wrong timestamp.
> So I can't do operations on UTC time stamps that are more than 6 months in the future?
If true, it's a bogus design. The false assumption is that timestamps
have infinite precision. We don't place that constraint on any other
physical quantity. Go ahead and allow UTC into the future; but just
adjust the precision accordingly. Where are the error bars in your
One solution is to somehow carry a measure of precision along with
the timestamp. Note that comparing file mod times of files 10 or 20
years ago does not require leap second tables.
Another possible solution is to recall how denormalized floating
point numbers work. There is an implicit trade-off here between
precision and range. I wonder if the same concept could apply
somehow to timestamps.
But where do you draw the line? The SI second was different 20
years ago compared to today. Are you going to include TAI rate
adjustment tables along with your new UTC library? There are
daily GPS time corrections available on the web; should those
be included too? What good is a nanosecond timestamp if the
server that generates it has microseconds of unknown error?
I guess I object to the whole notion of mixing pico or attosecond
precision with years or decades or centuries of range. Seconds
and days and years are three different clocks. If you find yourself
needing lots of bits, like more than 32 or 48 or 64, that is already
a warning sign that you're doing something very wrong.
If you're writing a time library that won't work with an Arduino that
too is a warning sign. Don't forget that Unix was the Arduino of its
day. So if you want to improve timekeeping for the future then start
with the hardware and software and the kids who will inherit the
future. I guess that's my 2 cents worth.
More information about the LEAPSECS