[time-nuts] Leap Quirks

M. Warner Losh imp at bsdimp.com
Sat Jan 3 16:18:17 EST 2009


In message: <26842.1231015338 at critter.freebsd.dk>
            "Poul-Henning Kamp" <phk at phk.freebsd.dk> writes:
: In message <495FB615.9080200 at rubidium.dyndns.org>, Magnus Danielson writes:
: 
: >> Having a message from ntp.c that says there was a leap
: >> to HH:MM:60 implies that HH:MM:60 is a valid time as far
: >> as ntp.c's author is concerned.
: >
: >It is valid UTC time, not valid POSIX time, which are two different things.
: 
: Well, it is a valid POSIX time, but it means a second later than
: desired in this case, because the 60 is taken as 60 seconds, and
: folded into a minute-roll-over.

It is a valid POSIX struct tm time.  But it doesn't represent a leap
second.  Instead, like you say, it wraps to the next minute.

There are not POSIXly compliant time_t values that will map to the
leap second value (23:59:60).  It is not possible to represent the
leap second in a time_t.

: >> Having used unix since edition V, I am also aware of how unix
: >> systems count off seconds since the epoch 1/1/1970.  But that
: >> really is immaterial to the discussion.
: 
: No, that is actually the crux of the matter...

Yes.  Such a simple definition gives so many possible ways to
interpret it.  The POSIX "there are no leap seconds" way.  The prior +
accumulated leap seconds.  And also the prior, plus the extra time
that accumulated between 1970 and 1972 in the UTC time scale...  But
that last one is kinda hard since it isn't an whole number of
seconds.

I've seen timescales try to use all of these definitions at one point
in my career or another (plus a boatload of others that seemed like a
good idea at the time to the inventors).

Warner




More information about the time-nuts mailing list