Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Nov 2020 18:40:30 -0700
From:      Ian Lepore <ian@freebsd.org>
To:        David Magda <dmagda+stable@ee.ryerson.ca>, freebsd-stable <freebsd-stable@freebsd.org>
Subject:   Re: NTP, UTC, and (negative) leap seconds
Message-ID:  <32809ec01dab023d5526b0b47fe0ad70ce558914.camel@freebsd.org>
In-Reply-To: <64E52A56-4C8F-4B9E-A4D3-33117C270D43@ee.ryerson.ca>
References:  <64E52A56-4C8F-4B9E-A4D3-33117C270D43@ee.ryerson.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 2020-11-19 at 19:50 -0500, David Magda wrote:
> Hello,
> 
> So there was a recent weblog post on a timekeeping observation:
> 
> 	https://fanf.dreamwidth.org/133823.html
> 	https://news.ycombinator.com/item?id=251458700  (via)
> 	https://en.wikipedia.org/wiki/Leap_second
> 
> In all circumstances in the past, leap seconds were added:
> 
> 	23:59:57Z
> 	23:59:58
> 	23:59:59
> 	23:59:60
> 	00:00:00
> 	00:00:01
> 
> The post brings up the possibility of a ´negativeˇ leap second, i.e.,
> a skip:
> 
> 	23:59:57Z
> 	23:59:58
> 	00:00:00
> 	00:00:01
> 
> Has anyone tested this scenario on FreeBSD?
> 
> Thanks for any info.
> 
> 

I run the freebsd kernel and ntpd through "negative" leap second events
usually a couple times a year as part of testing our timekeeping
products at $work.  I'm skeptical that we'll ever see a negative leap,
but we have some customers who insist on having it demonstrated to them
as working correctly.

The kernel and ntpd handle it just fine.  No telling what any given
application might do in reaction to a skipped second.  

I just did it now on one of our products.  I scheduled a negative leap
(from offset 37 to 36) to happen at the end of the day 2020-12-31, then
I used a debugging command to manually force the date/time on the unit
to 2020-12-31-23:58:00 and let it run.  In a terminal window I had a
bourne shell on that unit running 

  while true; do sleep 1; ntptime; echo; done

The output (trimmed to the range 23:59:55 - 00:00:10) looks like:

ntp_gettime() returns code 2 (DEL)
  time e398e47b.82ebd4d0  Thu, Dec 31 2020 23:59:55.511, (.511411404),
  maximum error 4000 us, estimated error 5 us, TAI offset 37
ntp_adjtime() returns code 2 (DEL)
  modes 0x0 (),
  offset 4.976 us, frequency 29.182 ppm, interval 128 s,
  maximum error 4000 us, estimated error 5 us,
  status 0x2121 (PLL,DEL,PPSSIGNAL,NANO),
  time constant 4, precision 0.001 us, tolerance 496 ppm,
  pps frequency 29.089 ppm, stability 0.128 ppm, jitter 0.937 us,
  intervals 23, jitter exceeded 6, stability exceeded 0, errors 2.

ntp_gettime() returns code 2 (DEL)
  time e398e47c.8d714b9c  Thu, Dec 31 2020 23:59:56.552, (.552510729),
  maximum error 4500 us, estimated error 5 us, TAI offset 37
ntp_adjtime() returns code 2 (DEL)
  modes 0x0 (),
  offset 4.957 us, frequency 29.182 ppm, interval 128 s,
  maximum error 4500 us, estimated error 5 us,
  status 0x2121 (PLL,DEL,PPSSIGNAL,NANO),
  time constant 4, precision 0.001 us, tolerance 496 ppm,
  pps frequency 29.089 ppm, stability 0.128 ppm, jitter 0.988 us,
  intervals 23, jitter exceeded 6, stability exceeded 0, errors 2.

ntp_gettime() returns code 2 (DEL)
  time e398e47d.92dbb5a0  Thu, Dec 31 2020 23:59:57.573, (.573665426),
  maximum error 5000 us, estimated error 5 us, TAI offset 37
ntp_adjtime() returns code 2 (DEL)
  modes 0x0 (),
  offset 4.937 us, frequency 29.182 ppm, interval 128 s,
  maximum error 5000 us, estimated error 5 us,
  status 0x2121 (PLL,DEL,PPSSIGNAL,NANO),
  time constant 4, precision 0.001 us, tolerance 496 ppm,
  pps frequency 29.089 ppm, stability 0.128 ppm, jitter 0.855 us,
  intervals 23, jitter exceeded 6, stability exceeded 0, errors 2.

ntp_gettime() returns code 2 (DEL)
  time e398e47e.9878316c  Thu, Dec 31 2020 23:59:58.595, (.595584418),
  maximum error 5500 us, estimated error 5 us, TAI offset 37
ntp_adjtime() returns code 2 (DEL)
  modes 0x0 (),
  offset 4.918 us, frequency 29.182 ppm, interval 128 s,
  maximum error 5500 us, estimated error 5 us,
  status 0x2121 (PLL,DEL,PPSSIGNAL,NANO),
  time constant 4, precision 0.001 us, tolerance 496 ppm,
  pps frequency 29.089 ppm, stability 0.128 ppm, jitter 1.006 us,
  intervals 23, jitter exceeded 6, stability exceeded 0, errors 2.

ntp_gettime() returns code 4 (WAIT)
  time e398e480.9dd6cf84  Fri, Jan  1 2021  0:00:00.616, (.616559624),
  maximum error 6000 us, estimated error 5 us, TAI offset 36
ntp_adjtime() returns code 4 (WAIT)
  modes 0x0 (),
  offset 4.899 us, frequency 29.182 ppm, interval 128 s,
  maximum error 6000 us, estimated error 5 us,
  status 0x2121 (PLL,DEL,PPSSIGNAL,NANO),
  time constant 4, precision 0.001 us, tolerance 496 ppm,
  pps frequency 29.089 ppm, stability 0.128 ppm, jitter 1.010 us,
  intervals 23, jitter exceeded 6, stability exceeded 0, errors 2.

ntp_gettime() returns code 4 (WAIT)
  time e398e481.a323571c  Fri, Jan  1 2021  0:00:01.637, (.637258156),
  maximum error 6500 us, estimated error 5 us, TAI offset 36
ntp_adjtime() returns code 4 (WAIT)
  modes 0x0 (),
  offset 4.880 us, frequency 29.182 ppm, interval 128 s,
  maximum error 6500 us, estimated error 5 us,
  status 0x2121 (PLL,DEL,PPSSIGNAL,NANO),
  time constant 4, precision 0.001 us, tolerance 496 ppm,
  pps frequency 29.089 ppm, stability 0.128 ppm, jitter 1.025 us,
  intervals 23, jitter exceeded 6, stability exceeded 0, errors 2.

ntp_gettime() returns code 4 (WAIT)
  time e398e482.a8977424  Fri, Jan  1 2021  0:00:02.658, (.658561327),
  maximum error 7000 us, estimated error 5 us, TAI offset 36
ntp_adjtime() returns code 4 (WAIT)
  modes 0x0 (),
  offset 4.861 us, frequency 29.182 ppm, interval 128 s,
  maximum error 7000 us, estimated error 5 us,
  status 0x2121 (PLL,DEL,PPSSIGNAL,NANO),
  time constant 4, precision 0.001 us, tolerance 496 ppm,
  pps frequency 29.089 ppm, stability 0.128 ppm, jitter 1.037 us,
  intervals 23, jitter exceeded 6, stability exceeded 0, errors 2.

ntp_gettime() returns code 4 (WAIT)
  time e398e483.ade1f3a4  Fri, Jan  1 2021  0:00:03.679, (.679229584),
  maximum error 7500 us, estimated error 5 us, TAI offset 36
ntp_adjtime() returns code 4 (WAIT)
  modes 0x0 (),
  offset 4.842 us, frequency 29.182 ppm, interval 128 s,
  maximum error 7500 us, estimated error 5 us,
  status 0x2121 (PLL,DEL,PPSSIGNAL,NANO),
  time constant 4, precision 0.001 us, tolerance 496 ppm,
  pps frequency 29.089 ppm, stability 0.128 ppm, jitter 1.014 us,
  intervals 23, jitter exceeded 6, stability exceeded 0, errors 2.

ntp_gettime() returns code 4 (WAIT)
  time e398e484.b3448064  Fri, Jan  1 2021  0:00:04.700, (.700264111),
  maximum error 8000 us, estimated error 5 us, TAI offset 36
ntp_adjtime() returns code 4 (WAIT)
  modes 0x0 (),
  offset 4.823 us, frequency 29.182 ppm, interval 128 s,
  maximum error 8000 us, estimated error 5 us,
  status 0x2121 (PLL,DEL,PPSSIGNAL,NANO),
  time constant 4, precision 0.001 us, tolerance 496 ppm,
  pps frequency 29.089 ppm, stability 0.128 ppm, jitter 1.051 us,
  intervals 23, jitter exceeded 6, stability exceeded 0, errors 2.

ntp_gettime() returns code 4 (WAIT)
  time e398e485.b8a6dacc  Fri, Jan  1 2021  0:00:05.721, (.721296182),
  maximum error 8500 us, estimated error 5 us, TAI offset 36
ntp_adjtime() returns code 4 (WAIT)
  modes 0x0 (),
  offset 4.804 us, frequency 29.182 ppm, interval 128 s,
  maximum error 8500 us, estimated error 5 us,
  status 0x2121 (PLL,DEL,PPSSIGNAL,NANO),
  time constant 4, precision 0.001 us, tolerance 496 ppm,
  pps frequency 29.089 ppm, stability 0.128 ppm, jitter 1.079 us,
  intervals 23, jitter exceeded 6, stability exceeded 0, errors 2.

ntp_gettime() returns code 4 (WAIT)
  time e398e486.bddfdac8  Fri, Jan  1 2021  0:00:06.741, (.741697917),
  maximum error 1000 us, estimated error 4 us, TAI offset 36
ntp_adjtime() returns code 4 (WAIT)
  modes 0x0 (),
  offset 4.060 us, frequency 29.182 ppm, interval 128 s,
  maximum error 1000 us, estimated error 4 us,
  status 0x2101 (PLL,PPSSIGNAL,NANO),
  time constant 4, precision 0.001 us, tolerance 496 ppm,
  pps frequency 29.089 ppm, stability 0.128 ppm, jitter 0.911 us,
  intervals 23, jitter exceeded 6, stability exceeded 0, errors 2.

ntp_gettime() returns code 0 (OK)
  time e398e487.cf8a7e74  Fri, Jan  1 2021  0:00:07.810, (.810707099),
  maximum error 1500 us, estimated error 4 us, TAI offset 36
ntp_adjtime() returns code 0 (OK)
  modes 0x0 (),
  offset 4.044 us, frequency 29.182 ppm, interval 128 s,
  maximum error 1500 us, estimated error 4 us,
  status 0x2101 (PLL,PPSSIGNAL,NANO),
  time constant 4, precision 0.001 us, tolerance 496 ppm,
  pps frequency 29.089 ppm, stability 0.128 ppm, jitter 0.826 us,
  intervals 23, jitter exceeded 6, stability exceeded 0, errors 2.

ntp_gettime() returns code 0 (OK)
  time e398e488.d4da7f3c  Fri, Jan  1 2021  0:00:08.831, (.831459235),
  maximum error 2000 us, estimated error 4 us, TAI offset 36
ntp_adjtime() returns code 0 (OK)
  modes 0x0 (),
  offset 4.028 us, frequency 29.182 ppm, interval 128 s,
  maximum error 2000 us, estimated error 4 us,
  status 0x2101 (PLL,PPSSIGNAL,NANO),
  time constant 4, precision 0.001 us, tolerance 496 ppm,
  pps frequency 29.089 ppm, stability 0.128 ppm, jitter 0.809 us,
  intervals 23, jitter exceeded 6, stability exceeded 0, errors 2.

ntp_gettime() returns code 0 (OK)
  time e398e489.da869404  Fri, Jan  1 2021  0:00:09.853, (.853616381),
  maximum error 2500 us, estimated error 4 us, TAI offset 36
ntp_adjtime() returns code 0 (OK)
  modes 0x0 (),
  offset 4.012 us, frequency 29.182 ppm, interval 128 s,
  maximum error 2500 us, estimated error 4 us,
  status 0x2101 (PLL,PPSSIGNAL,NANO),
  time constant 4, precision 0.001 us, tolerance 496 ppm,
  pps frequency 29.089 ppm, stability 0.128 ppm, jitter 0.796 us,
  intervals 23, jitter exceeded 6, stability exceeded 0, errors 2.

ntp_gettime() returns code 0 (OK)
  time e398e48a.e0216c60  Fri, Jan  1 2021  0:00:10.875, (.875510596),
  maximum error 3000 us, estimated error 4 us, TAI offset 36
ntp_adjtime() returns code 0 (OK)
  modes 0x0 (),
  offset 3.996 us, frequency 29.182 ppm, interval 128 s,
  maximum error 3000 us, estimated error 4 us,
  status 0x2101 (PLL,PPSSIGNAL,NANO),
  time constant 4, precision 0.001 us, tolerance 496 ppm,
  pps frequency 29.089 ppm, stability 0.128 ppm, jitter 0.653 us,
  intervals 23, jitter exceeded 6, stability exceeded 0, errors 2.

-- Ian





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