cvs commit: src/usr.bin/vmstat vmstat.c src/usr.bin/w w.c
M. Warner Losh
imp at bsdimp.com
Thu Oct 20 08:24:28 PDT 2005
In message: <25112.1129812291 at critter.freebsd.dk>
"Poul-Henning Kamp" <phk at 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
More information about the cvs-src
mailing list