[LEAPSECS] POSIX and C (Was: Re: ISO Influence)

Warner Losh imp at bsdimp.com
Wed Dec 22 12:33:41 EST 2010


On 12/19/2010 09:33, Steve Allen wrote:

> Change the name of the broadcast time scale from UTC to TI (as

> recommended at the 2003 Torino ITU-R colloquium), omit the leap

> seconds from the broadcasts, and put them into zoneinfo.

You might think this is a good idea.

However, there are a number of practical issues that get in the way of
this idea:

(1) zoneinfo files need to be updated on a regular basis. Often they
are only updated when your locale changes DST rules.
(2) When they are updated, long running programs need to re-read the
zoneinfo files. Currently they do not. For systems that reboot often,
this is a minor annoyance. For systems that reboot every couple of
years, having to restart the application to pick up new leap seconds
would meet with customer resistance.
(3) cron misbehaves on these systems at times. When I've used them in
the past, it would schedule jobs in TAI time rather than UTC time.

There are many programs that assume that there's no offset wrt
gettimeofday and friends, which causes things to run a little late (and
a little more late over time).

These issues could be addressed, but when I tried to plow down this path
several years ago I stopped after suffering a death of a thousand cuts
(plus the 1 + 2 double whammy mean I had to start hacking the time code
in libc to provide a way to reload the time info for the program).

Plus you still have all the ambiguity issues in POSIX about delta times,
which means in addition to having the leap seconds available in the
zoneinfo files, you have to export tables of them so you can compute the
actual elapsed time between two time_t's, rather than the adjusted
elapsed time. This doesn't really change that unless you change
programs to grok the new paradigm. There's a lot of code that assumes:

time_t t;
t += 86400;

is the same time tomorrow (or other variations on a fixed-length day),
which POSIX mandates, but which doesn't model UTC around leap seconds.

Warner




More information about the LEAPSECS mailing list