[6485] in Kerberos

home help back first fref pref prev next nref lref last post

Re: More gmt_mktime trouble: breaks on systems with leap seconds

daemon@ATHENA.MIT.EDU (John Hawkinson)
Tue Jan 16 20:00:42 1996

Date: Tue, 16 Jan 1996 19:44:52 -0500
To: jik@annex-1-slip-jik.cam.ov.com (Jonathan Kamens)
Cc: kerberos@MIT.EDU
In-Reply-To: "[6482] in Kerberos"
From: John Hawkinson <jhawk@MIT.EDU>

> For example.... I don't know all of the leap seconds that have
> occurred over the years, but I know about the one that occurred at
> the end of 1995, so I added it to my Linux system by creating a
> "leapseconds" file and installing it with "zic -L leapseconds <time
> zone definition files>".

The timezone package distributed via ftp from elsie.nci.nih.gov
includes a lot of relevent information. (It's part of NetBSD, too). Anyway:

# Leap  YEAR    MONTH   DAY     HH:MM:SS        CORR    R/S
Leap    1972    Jun     30      23:59:60        +       S
Leap    1972    Dec     31      23:59:60        +       S
Leap    1973    Dec     31      23:59:60        +       S
Leap    1974    Dec     31      23:59:60        +       S
Leap    1975    Dec     31      23:59:60        +       S
Leap    1976    Dec     31      23:59:60        +       S
Leap    1977    Dec     31      23:59:60        +       S
Leap    1978    Dec     31      23:59:60        +       S
Leap    1979    Dec     31      23:59:60        +       S
Leap    1981    Jun     30      23:59:60        +       S
Leap    1982    Jun     30      23:59:60        +       S
Leap    1983    Jun     30      23:59:60        +       S
Leap    1985    Jun     30      23:59:60        +       S
Leap    1987    Dec     31      23:59:60        +       S
Leap    1989    Dec     31      23:59:60        +       S
Leap    1990    Dec     31      23:59:60        +       S
Leap    1992    Jun     30      23:59:60        +       S
Leap    1993    Jun     30      23:59:60        +       S
Leap    1994    Jun     30      23:59:60        +       S
Leap    1995    Dec     31      23:59:60        +       S

> After doing so, here's what happens when a time value is encoded
> with gmtime() and then decoded with gmt_mktime() (this is output
> from a debugging main() that I added to gmt_mktime.c, as shown in
> the patch at the end of this message):

You should consult the above package, specifically the time2posix(3)
manpage. Basically, POSIX doesn't support leap seconds, so if they're
in use on your local machine, you should _expect_ things to break.  If
you want your applications to have support for this, you should use
time2posix() on your local time before passing them across the wire.

Anyway, I think the right answer is for autoconf to test for
HAVE_TIME2POSIX (or whatever) and if so, kerberos should use
time2posix() and posix2time() in the appropriate places.

It would be a bad idea for Kerberos to have kludgey leap second
support, though, particularly since they aren't POSIX-compliant.

I suppose I ought to include the obligatory flame that the kerberos
team (of which I'm not a member) frowns on #ifdefs that aren't
autoconf derived, and submitting patches containing strings like
"#ifndef PUNT_LEAPSECONDS" is likely to make them less than pleased.

--jhawk

home help back first fref pref prev next nref lref last post