FreeBSD handles leapsecond correctly

Poul-Henning Kamp phk at
Mon Jan 2 11:54:04 PST 2006

In message <20060102162117.GB14097 at>, Matthias Andree writes:

>> First of all, TAI is not a real-time clock, it is an after the fact
>> paper clock.
>That depends on what you consider "real time" (without dash). Ask two
>experts and get three opinions. I don't mean to bikeshed here, I'm

TAI is a paper clock, end of story.

It is calculated from comparisons between a large number of atomic
frequency standards from all over the world.

Estimates of TAI may exist in real time, but TAI does not and
therefore the BIPM, CCTF and IERS actively discourages its use as
anything but a reference timescale.

It can be argued that this is not a sensible position on their part,
but that is nontheless their position.

>I'm only annoyed that POSIX pretends leap seconds were non-existant, and
>even more because I have no satisfactory answer to my question how
>FreeBSD knows that a file created at 23:59:59.2 is older than a file
>created at 23:59:60.1 if the timestamp is recycled but rather
>unsubstantiated assumptions about the amount of research I have done. I
>don't want to bore readers on mailing lists with epic breadth...

No POSIX compliant system can tell the difference, not even FreeBSD.

>Markus Kuhn suggested adding a new interface, or as an alternative
>solution, smoothing the UTC by slewing the clock ("UTS") for the past
>1,000 seconds before the insertion or deletion of the leap second.

Yes, that is a total non-starter, now we don't even know how long
seconds are going to be any more :-(

>TAI is the monotonous timescale that computers should have been using
>since Epoch, but I'm not sure who was there first, TAI or UNIX.

No, no and no.

Computers should use UTC because UTC underlies civil timekeeping.

It's the definition of UTC that is the problem, not the choice of it.

>Does POSIX specify a solution to the problem with the ordering of the
>two files' age I outlined above? Not to my knowledge, so how can it
>possibly be "correct"?

If there are no more leap seconds, POSIX doesn't have to specify
how to deal with them.

>It appears all POSIX machines I look after got the leap second right one
>way or another[...]

None of them got it right by any strech of the imagination because 
it is impossible to get it right and be POSIX compliance.

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

More information about the freebsd-current mailing list