sntpclock — check a system's clock through SNTP
sntpclock {host}
sntpclock connects to an NTP server on port 123 of host and acts as a "leaf node" using the SNTP (RFC 2030) subset of NTP (RFC 1305).
host must be a dotted-decimal IPv4 address, or the value 0 which is translated to the IP address 127.0.0.1.
sntpclock prints to its standard output a 16-byte TAI64NA adjustment that, when added to the local UNIX clock, will produce the TAI clock on host.
This is suitable for input to programs such as clockadd(1) and clockview(1).
sntpclock limits the adjustment to 2 days.
sntpclock does not bind to port 123; this means that it does not need to run as the superuser. It may, rather, use any non-reserved source port that the operating system selects.
An NTP timestamp is a count of non-leap seconds. sntpclock uses a local leap-second table to convert the NTP timestamp to TAI with an epoch of 1970-01-01 00:00:10 TAI. For a discussion of the difference between UTC and TAI see UTC and TAI.
SNTP transactions that cross a leap second will not correctly synchronize a system where the system clock ticks in SI (a.k.a. TAI) seconds. This is a problem with the protocol itself, as the UTC timestamp does not uniquely identify 1 TAI second at the point of a positive leap second. Avoid using sntpclock across a leap second on such systems.
The 32-bit NTP time scale of RFC 1305 (and RFC 5905, which does not change the 32-bit on-the-wire seconds counts) will break down in 2036. There is a suggested convention in RFC 4330 to extend this to 2104, subject to a window where the protocol breaks down because of an all-zero field, which however was obsoleted by a complex system of assumed "eras" in RFC 5905. A better approach is to use a 64-bit on-the-wire protocol that includes leap seconds and ticks SI seconds, such as the TAICLOCK protocol.