NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: number of seconds since the epoch
On Dec 9, 2010, at 3:50 AM, Robert Elz wrote:
>> Also, it looks like even if I do replace the zoneinfo files, time,
>> gettimeofday, and
>> clock_gettime will still behave badly on a leap second, and rewind.
>
> Ah, no, leap seconds don't work like that. The system as a whole has
> never heard of leap seconds, and will just ignore them. That means, the
> leap second is treated exactly the same as any other second (not that we
> pretend it never happened and time stood still).
Agreed. If you want a clock which always counts forward and does not rewind or
jump forward when a leap second happens, time(0) and
clock_gettime(CLOCK_MONOTONIC, ...) ought to be usable without any further
tweaks. If you want to consider "wall time" including leap seconds, daylight
savings time bouncing the hour back and forth, etc, then that is what
clock_gettime(CLOCK_REALTIME, ...), gettimeofday(), etc are for.
As for ntpd, stratum-1 NTP timeservers are expected to either keep a current
version of the leapseconds file, or be deriving their time from a reference
source like GPS, ACTS, WWBV, etc which provides leap-second indications.
Higher stratum NTP servers rely on leap-second indications provided by
stratum-1 timesources.
Regards,
--
-Chuck
Home |
Main Index |
Thread Index |
Old Index