Time Libraries Rough Draft

Ashley Yakeley ashley at semantic.org
Wed Feb 9 23:46:30 EST 2005

In article <200502092100.00086.p.turner at computer.org>,
 Scott Turner <p.turner at computer.org> wrote:

> A good draft.  Questions:
> 1. Are DiffTime and UTCDiffTime specified as picoseconds, or must we use 
> timeToSISeconds when we need a time difference with units?

It seems people prefer to hide the constructor, in which case you'd have 
to use the conversion functions. We could have Integer "picoseconds" 
conversion functions as well, perhaps.

> 2. In a UTCTime, is the DiffTime limited to 86400 or 86401 or unlimited?

The maximum value is 86401*10^12-1. The minimum value is 0.

> I don't see an overall benefit from distinguishing UTCDiffTime from DiffTime. 
> The representation of UTCTime forces them to have identical precision and 
> often to have the same meaning.

The idea is that a UTCDiffTime ignores leap seconds, and DiffTime 
doesn't. Thus I can express the concept "three hours UTC" as a 
UTCDiffTime, which will take us from 11:00:00pm to 2:00:00am across a 
leap second. By contrast, "three SI hours" is a fixed period of time, 
and would be 11:00:00pm to 1:59:59am if a leap-second intervenes.

> The names timeToSISeconds and siSecondsToTime might be better without the SI, 
> as timeToSeconds and secondsToTime. Our clocks will be having hiccups when 
> leap seconds arrive so they won't always tell SI seconds. Also times prior to 
> UTC have seconds of different lengths.

timeToSISeconds and siSecondsToTime work entirely with DiffTime, which 
is cleanly monotonic and doesn't hiccup. The difference between to TAI 
times is a DiffTime and is measured in fixed unvarying SI seconds.

> The addUTCTime and diffUTCTime functions are a concern because your earlier 
> email said that they should ignore leap seconds.  That is plenty useful but 
> it's likely to bite a naive user.  I'd like them to be called 
> addUTCTimeNoLeap and diffUTCTimeNoLeap.

The idea is that if you stay entirely within the UTC "world", getting 
UTC time from the clock, and using UTCTime and UTCDiffTime, and printing 
out the UTC time, all your calculations should come out as expected. The 
only difference is that the scale is not monotonic with real time. You 
cannot in any case cross into the TAI "world" without a LeapSecondTable.

Ashley Yakeley, Seattle WA

More information about the Libraries mailing list