[ntp:questions] Leap seconds
Enrique Perez-Terron
enrio at online.no
Mon Jan 24 03:06:37 UTC 2005
On Wed, 2005-01-19 at 21:04 -0500, Richard B. Gilbert wrote:
> Alain wrote:
>
> >
> > Brad Knowles escreveu:
> >
> >> At 5:46 PM -0200 2005-01-19, Alain wrote:
> >>
> >>> What happens when a leap second is inserted or removed in UTC? Will it
> >>> be the same on my NTP client machine or will it be skewed?
> >>
> >>
> >> It's handled automatically. You don't have to do anything.
> >
> >
> > Sorry, I believe that my question was not clear: In which way will it
> > be handled? Skeweing or leaping?
> >
> > Alain
>
> If a leap second is inserted, 23:59:59 will be followed by 23:59:60
> which, in turn, will be followed by 00:00:00. If a leap second is
> subtracted, 23:59:58 is followed by 00:00:00.
IIRC, the Unix notion of seconds since the epoch (1970) will be
unaffected by leap seconds, which means that the epoch is actually moved
a second. In other words, the output of
date -d "2005-07-05 12:00:00" +%s
will be the same if a leap second is inserted before 2005 july 1 0:00:00
as if not.
Also, I suppose that the c-library function call localtime(1120557600)
will return a struct tm corresponding to the date 2005-07-05 12:00:00.
Furthermore, that the call difftime(1120557600, 0) will return
1120557600.0 as a double, without taking into consideration the leap
seconds in the the time interval.
Please correct me if I am wrong.
This raises the question what will time(NULL) return at
23:59:58, 23:59:59, 23:59:60, 00:00:00, and what will gettimeofday()
return - and when will it return? (I have seen a proposal to have
gettimeofday() sleep until 00:00:00 if called after 23:59:59.9999 but
before 00:00:00.)
Excuse my ignorance, does ntp count the time only in standard calendar
ways, or does it have a notion of seconds since an epoch? In case of
the latter, does this number increase monotonically at a constant rate?
Is this time available for applications outside ntpd?
--
Regards,
Enrique Pérez-Terrón
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ntp.org/pipermail/questions/attachments/20050124/add2bdf4/attachment.pgp>
More information about the questions
mailing list