3 ms·
NTP provides UTC. UTC deviates from TAI by a number of whole seconds, the original offset plus all the leap seconds added since.
by mytailorisrich 2y ago
NTP provides UTC. UTC deviates from TAI by a number of whole seconds, the original offset plus all the leap seconds added since.
- globular-toast 2y agoSo you subtract the number of leap seconds from the UTC clock to get TAI? How do you update the number of leap seconds to subtract?
- mytailorisrich 2y agoYou never do this sort of conversion manually. On linux you can use clock_gettime() with CLOCK_TAI: CLOCK_TAI (since Linux 3.10; Linux-specific) A nonsettable system-wide clock derived from wall-clock time but ignoring leap seconds. This clock does not experience discontinuities and backwards jumps caused by NTP inserting leap seconds as CLOCK_REALTIME does. The acronym TAI refers to International Atomic Time. Now, leap seconds are advertised in advance and your system know when they occur through a leap seconds file (leap-seconds.list) that needs to be kept up to date.
- globular-toast 2y agoAh, thanks. I didn't think it sounded like something to do in application code.