[ntp:questions] Preparing for the leap second
martin.burnicki at meinberg.de
Wed Feb 8 17:45:58 UTC 2012
Marco Marongiu wrote:
> Hi again
> Anybody willing to help with this procedure? There are some spots where
> I could use some suggestions:
> Il 11/01/2012 17:12, Marco Marongiu ha scritto:
>> Please let me know if this could be a good way to test if a given
>> combination OS/ntpd will behave (doesn't apply to Windows tho).
>> I should shut down ntpd and configure the node as an "orphan" --
>> maybe unplugging the network cable, or shutting down the interface,
>> or setting no "server" for it... whatever it is.
>> Then I should set the clock close to midnight, start ntpd again, and
>> ask the kernel to insert a leap second. Or maybe I should insert the
>> leap second _before_ starting ntpd?
You should simply set up one machine as NTP server with the current leap
second file which announces a leap second for the end of June, 2012.
Depending on the NTP version on the server, you should use "orphan" or
configure only the "local clock" as reference time, so the server just
outputs its own system time. You should also fudge the server to a good
stratum for this test.
Then you should set UTC time on that server close to (maybe 1 or 2 hours
before) midnight for the correct leap second date, e.g. 22:00 UTC on
June 30, 2012, and start ntpd on the server.
Don't make the time interval before UTC midnight too short to give ntpd
some time to "settle" after startup.
If you try with a different date then ntpd might not accept the leap
second since (if I remember correctly) it does some plausibility checks
and tests if the leap second has been scheduled for June 30 or for
Finally you can start all your client machines, run something like the
script you have proposed, maybe with an additional sleep of a few
milliseconds, on the clients and on the server, e.g.:
>> while true ; do date +%H:%M:%S.%N ; sleep 0.2; done | tee time.log
Keep in mind that your "date" command which I've quoted above prints
local time, not UTC, so when the leap second occurs the command may not
show midnight, but a time offset according to your timezone setting. Try
"date -u" to display your system's UTC time.
In the time interval before UTC midnight you can run "ntpq -c rv" on the
server and on the clients to see if the leap second warning has been
recognized on the server and propagated to the clients, in which case
you should see "leap=01" in the output.
>> I understand I could add a fake leap second by using "adjtimex -S",
>> or by using a fake leapseconds file. Is it correct? Any adjtimex
>> command line you may want to suggest, or discourage me to use?
I have never tried this, but using the leapsecond file on your server
should be straightforward.
>> Then, I should just watch the clock go, and see if it is monotonic
>> when midnight comes. Would this be a good way to do that?
> As I said in another message, I am mainly thinking of Linux, all 2.6
> series, or above; distributions may be Debian Squeeze, some Ubuntu 10.04
> LTS or higher, a very few Debian Lenny.
> If possible, I'd be interested in Windows XP and higher (for desktops).
> Nice to have, modern versions of Solaris -- like 11 and OpenIndiana.
You can use any OS and any client you want to test in parallel if you
point them to the test server, and see how it works on each machine.
More information about the questions