[time-nuts] Leap Quirks

Magnus Danielson magnus at rubidium.dyndns.org
Sat Jan 3 14:01:41 EST 2009


Chuck Harris skrev:
> M. Warner Losh wrote:
>> In message: <m31vvks3e9.fsf at lugabout.jhcloos.org>
>>             James Cloos <cloos at jhcloos.com> writes:
>> : >>>>> "Chuck" == Chuck Harris <cfharris at erols.com> writes:
>> : 
>> : Chuck> The message implies that linux clocks counted:
>> : 
>> : Chuck> 58..59..60..00..01
>> : 
>> : Chuck> Which would not be the POSIX way.
>> : 
>> : No, the linux clocks counted:
>> : 
>> : 1230768021..1230768022..1230768023..1230768024..1230768025
>> : 
>> : where 1230768024 is 2009-01-01 00:00:00 UTC.
>> : 
>> : What gets output by any given userland apps depends on those apps.
>> : 
>> : If one uses the Olsen tz database, the right zonefiles rather than the
>> : posix zonefiles, and a libc such as glibc, then one will have seen the
>> : seconds tick off 58..59..60..00..01.
>> : 
>> : But that is purely a userland issue.
>> : 
>> : If one uses the (lobotomized) posix zonefiles, one will have seen the
>> : seconds tick off 21..22..23..24..25.
>> : 
>> : (Interesting coincidence there, that 1970 through 2008 (inclusive) has a
>> : number of days divisible by 5.  Which makes for a nice, even 1230768000
>> : seconds, were there no leap seconds.)
>>
>> That doesn't match POSIX's mandated behavior...  time_t % 86400 == 0
>> at midnight is an invariant that's violated by the above sequence.  
>>
>> Warner
> 
> Which is what my message was saying.  If linux does count 58..59..60..0
> instead of 58..59..59..0, then it isn't following POSIX. [I have no
> interest in getting into an argument over whether linux, or POSIX
> should count that way.]
> 
> 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.

> 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, since that is what POSIX says and Linux honours unless running NTP.

Cheers,
Magnus




More information about the time-nuts mailing list