Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Oct 2005 09:24:42 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        phk@phk.freebsd.dk
Cc:        cvs-src@freebsd.org, src-committers@freebsd.org, andre@freebsd.org, cvs-all@freebsd.org, bde@zeta.org.au
Subject:   Re: cvs commit: src/usr.bin/vmstat vmstat.c src/usr.bin/w w.c 
Message-ID:  <20051020.092442.32432175.imp@bsdimp.com>
In-Reply-To: <25112.1129812291@critter.freebsd.dk>
References:  <20051020211131.A874@delplex.bde.org> <25112.1129812291@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <25112.1129812291@critter.freebsd.dk>
            "Poul-Henning Kamp" <phk@phk.freebsd.dk> writes:
: This means that there is no way to tell which side of an inserted
: leapsecond a time(2) timestamp comes from:
: 
: 	UTC		time(2)
: 	23:59:57	N-3
: 	23:59:58	N-2
: 	23:59:59	N-1
: 	23:59:60	N
: 	00:00:00	N
: 	00:00:01	N+1

Actually, time goes like the following near a leap second:
 	23:59:57	N-3
 	23:59:58	N-2
 	23:59:59	N-1
 	23:59:60	N-1
 	00:00:00	N
 	00:00:01	N+1

although mktime() will turn the above times into the sequence that you
posted, mostly because POSIX didn't grok that the leap second was
added to the end of the prior day, not the beginning of the next day.
They mandated 'just normalize it' behavior which is sadly wrong.

Ntp mandates the latter, so that's what we do over a leap second for
system time.

: Worst case, difftime() will be wrong by two seconds: taking the difference
: from one leapsecond to another and guessing wrong in both ends.

However, this nit doesn't change your main point.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051020.092442.32432175.imp>