Time Libraries Rough Draft
Daan Leijen
daan at cs.uu.nl
Fri Feb 11 08:19:12 EST 2005
Ketil Malde wrote:
> Seth Kurtzberg <seth at cql.com> writes:
>>>Yes, because TAI is a clock, not a calendar.
>>We are getting bogged down in the terminology here.
> I've tried -- but am happy to try again -- to propose:
>
> clock : something that measures the passage of time,
> unit is seconds
>
> calendar: something that deals with the passage of time
> with other units -- hours, minutes, years, dates
I believe this discussion is continually bogged down in terminology :-)
Here is how think of it.
clock: measures passage of absolute time (time difference). Best
available unit is (TAI) SI seconds (ie. cesium atom
oscillations)
calendar: gives time *stamps* to human related notion of time. Can be
used to calculate calendar time differences, ie. human
notions of time difference, like days and months, and yes,
*calendar* seconds (ie. not absolute SI seconds).
TAI is a clock. Sometimes they give it as date, but really, it is just
SI-seconds since some epoch (specified as an UTC calendar date!)
UTC is a calendar. UTC is a special calendar because its normal seconds
are specified by an absolute time duration: a UTC second is a SI second.
The strange thing about UTC is that days (and months etc) are defined
with respect to the rotation of the earth. Therefore, a day does not
always have 84600 UTC seconds, but sometimes one more or less (= leap
seconds). Which days have a second more or less is defined by a leap
table (which is undefined for the future). This means that, like any
calendar, you can calculate UTC date differences in days and months,
but not in seconds (unless you happen to know the leap seconds).
Furthermore, you can not use UTC seconds as time durations, as there
are sometimes leap second insertions/deletions (that last 0 SI-seconds).
Now what I understand about implementation:
- gettimeofday() returns the number of seconds since epoch (a UTC date)
What kind of seconds does it return? Well, (A) sometimes these are just
SI-seconds (which means we can derive TAI from that), but sometimes (B)
it returns UTC-seconds -- ie. the absolute SI-second count, plus/minus
any leap seconds that have occurred.
Is there anyone on this list who can give a solid overview of what
"gettimeofday" returns, and if we can distinguish (A) from (B)?
I guess some/most of this is already said on this list, but it seems
somewhat hidden in the posts and clouded by misinformation :-)
I know that libtai assumes (A) which is wrong in general.
All the best,
-- Daan.
More information about the Libraries
mailing list