[LEAPSECS] POSIX Time (was WP7A)

Zefram zefram at fysh.org
Mon Oct 12 06:27:21 EDT 2009


Steve Allen wrote:

>I do not see the number 86400 anywhere in that text.


It appears in the equation (actually, a C expression) that was referenced
in that text. PHK only quoted chunks of rationale there, not the main
text of the standard, where the equation appears. It's the infamous
equation that originally failed to account for the century rule for
leap days. The leap-day-correct version of the equation is

tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 +
(tm_year-70)*31536000 + ((tm_year-69)/4)*86400 -
((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400

(The equation only applies where tm_year >= 70. You'd need to amend
the divisions to sensibly handle earlier years.) The accompanying
text (again, part of the main body of the standard) says that tm_sec,
tm_min, tm_hour, tm_yday, and tm_year together constitute a UTC label,
and there's nothing there saying that it doesn't apply to leap seconds.
The number appears again in the main text:

As represented in seconds since the Epoch, each and every day
shall be accounted for by exactly 86400 seconds.

which would be somewhat confusing, but the rationale (as PHK quoted)
makes clear that "seconds since the Epoch" isn't intended to be literally
a count of seconds. Hence my earlier statement (and similar statement
in Wikipedia's [[Unix time]]) that time_t values increase by 86400 per
day regardless of actual day length.

-zefram


More information about the LEAPSECS mailing list