[LEAPSECS] leap smear

Warner Losh imp at bsdimp.com
Mon Sep 19 11:48:38 EDT 2011



On Sep 19, 2011, at 4:27 AM, Tony Finch wrote:


> Joe Gwinn <joegwinn at comcast.net> wrote:

>>

>> Yes. As defined, POSIX time is in effect a form of TAI, differing by a

>> constant offset, but this is nowhere stated.

>

> That's because what you say is wrong. The offset between TAI and time_t

> steps when there is a leap second just like UTC, but time_t has no way to

> represent a leap second.


Also, POSIX talks about the time being nominally UTC, but it can't be exactly UTC because of the leap second issue. POSIX also specifies that the error in measurement of an instant is unspecified (eg, there's no specification for the accuracy of the clock relative to an external source). Just as there's no formal specification in POSIX for the phase error, neither is there a formal specification for the frequency error. These three facts mean that time_t is, at best, an approximation of UTC with what happens when the time_t model doesn't match the UTC model being left unspecified. With all these conflicting requirements, it is easy to see why chose the 'paper over the fact that leap seconds actually exist by presenting a time scale to its users where leap seconds don't exist to more closely match the passage of time as modeled by time_t.'

I'm still not convinced that this isn't POSIX compliant behavior. :) To those that say it introduces a phase error, I ask to see the phase error spec in POSIX. To those that say time doesn't tick at an SI rate, I say the same, plus trot out the adjtime interface (and underlying temperature variation causing xtals to not tick at exactly the SI rate, except by accident). To those who say it is ugly and inelegant, I agree, but we aren't talking beauty here, we're talking POSIX :)

To conform to posix you are left with: (1) step time_t. (2) introduce a phase error (eg, make time_t track TAI or GPS and weasel out of things with the lack of a time error spec) (3) Introduce both a transient phase and frequency error to paper over the inconvenient reality going on behind the scenes.

(3) is also used, btw, when ntpd detects an error in time, perhaps due to a system being disconnected or rebooted with a BIOS that has drifted a second.

From a practical point of view, many applications can cope with this. From a pedantic point of view, or for more demanding applications, this clearly falls down.

Warner



More information about the LEAPSECS mailing list