[time-nuts] Leap Quirks

James Cloos cloos at jhcloos.com
Sat Jan 3 18:24:54 UTC 2009


>>>>> "Warner" == M Warner Losh <imp at bsdimp.com> writes:

Warner> That doesn't match POSIX's mandated behavior...  time_t % 86400 == 0
Warner> at midnight is an invariant that's violated by the above sequence.  

By which sequence?

At every point in time where time_t % 86400 == 0 is true gmtime(2), when
using no zoneinfo file or when using a posix zoneinfo file, will return
a struct tm where the time of day is 00:00:00.

(time_t)1230768024 was 2009-01-01 00:00:00 right/UTC
(time_t)1230768000 was 2009-01-01 00:00:00 posix/UTC

and the real 2009-01-01 00:00:00 UTC was exacly 1230768024 si seconds
after 1970-01-01 00:00:00 UTC.

That this leap second was (time_t)1230768023 is is a simple fact of how
long it has been since the start of 1970.

That POSIX pretends that 2009 UTC started 24 seconds earlier than it
did is a bug.

Anyone who has some requirement to exactly match POSIX as published can
use the posix zoneinfo files and have time_t % 86400 == 0 as midnight
“UTC” every day.  Their idea of time will be off, but they get to keep
their fixed-sized intervals.

Anyone who wants to track the real UTC can do so using the right
zoneinfo files.  By doing so they explicitly choose to ignore
that particular bit of nonsense in POSIX, but that is OK since it
is their choice.

Everyone gets to choose which they prefer.

-JimC
-- 
James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6



More information about the time-nuts mailing list