[time-nuts] Leap Quirks

Poul-Henning Kamp phk at phk.freebsd.dk
Sun Jan 4 04:44:33 EST 2009


In message <4960027E.1000103 at erols.com>, Chuck Harris writes:
>Poul-Henning Kamp wrote:

>>> Ok, that is news to me.  Are you saying that (pulling a number out of
>>> the air) time_t = 21120123 could be followed by 21120123 on a year where
>>> we added a leap second?
>> 
>> Apart from the number, that is exactly what happens: The last
>> second of the (UTC) day is recycled twice.
>
>[...] and all of the sources I have found
>concur that time_t is the number of seconds since 1/1/1970 UTC without
>regard to leap seconds.
>
>When did this change?

Never, that's the trouble.

time_t is better defined as:

	d * 86400 + min(rs, 86399)

where:
	d = Number of complete days since 1970-01-01H00:00:00Z 
	rs = number of seconds since UTC midnight.

Eliminating leapseconds would make it correct however.

-- 
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 time-nuts mailing list