[ntp:hackers] Leap second support in versions prior to 4.2.6

Warner Losh imp at bsdimp.com
Mon Jun 4 20:05:17 UTC 2012


On Jun 4, 2012, at 1:21 PM, Mike S wrote:

> On 6/4/2012 2:30 PM, Hal Murray wrote:
>> 
>> mikes at flatsurface.com said:
>>> I think you're complaining about systems which don't do it right, not  leap
>>> seconds themselves.
>> 
>> But POSIX pretends that leap seconds don't exist, so that's a lot of systems.
> 
> POSIX also pretends that the current definition of UTC existed in 1970. It obviously wasn't well designed, from a timekeeping perspective.

Except that this generally doesn't produce problems.  There's a 2s offset for things in 1970, which is an interesting wart that affects a vanishingly small number of applications.  Leap seconds, on the other hand, is a wart that gets shaved off every 18 months or so and somebody trips over the hick-up.

> Since it's present on so many systems, that merely argues that code written to run on a POSIX system should be written to handle its timekeeping peculiarities. Putting this burden on application developers, instead of in the OS/utils, is another poor design decision.

Sure, it is a poor decision.  It is the decision that we're stuck with.  Complaining about it is fun, but not productive.

>> Are there any common OSes and/or APIs that do it correctly and cleanly?
> 
> If I understand things correctly, you can use the "right" zoneinfo TZs on Linux (and some other *nix) OSs to do so (making them non-POSIX in this regard). You just need to keep the zoneinfo files updated so they contain new leap second info.

You do not understand correctly.  The right zoneinfo files help, but do not completely solve the problem.  They aren't read again for long running applications, they don't solve the midnight problem (since the underlying time scale isn't aligned to local time, the time things in cron start to skew) and there's not good integration between them an ntpd.

So it is a band-aide that gives mostly tolerable results for system whose up time is less than 18 months or so.

Warner



More information about the hackers mailing list