[LEAPSECS] What's the point?
Warner Losh
imp at bsdimp.com
Thu Feb 10 19:32:30 EST 2011
On 02/10/2011 17:14, Paul Sheer wrote:
>> It's been a while... Can you remind me why we will need to continue
>> to pretend that there are 86400 SI seconds in a day, past the time
>> when there are actually 86401 (or more)?
>>
> Why is because there is a semi-infinite number of existing
> lines of code, right now in use, that calculate the day from
> the second and visa-versa using,
>
> d = t / 86400
> t = d * 86400
>
> they do this for reasons of a) expediency b) interoperability,
> and c) conformance to POSIX v3.
and these lines of code have a semi-infinite variety in their subtlety.
86400 might not even appear in the code:
s += 3600; /* Same time next hour */
or
s += delta_t;
if (s > SPM) {
m += s / SPM;
s %= SPM;
}
if (m > MPH) {
h += m / MPH;
m %= MPH;
}
if (h > HPD) {
d += h / HPD;
h %= HPD;
}
etc
Warner
More information about the LEAPSECS
mailing list