Skip to content

Leap Seconds and TAI

  • The core functions, which every industry uses.

UTC has had a second 60 on some days since 1972. Each one was inserted so that UTC stays close to the rotation of the Earth, and each one made the number of seconds that UTC trails TAI (International Atomic Time) grow by one. The timescale/ namespace holds that table and the functions that read it. A date, a count and a conversion all come from the same table, so none of them takes a number you typed in.

The table follows the IERS file Leap_Second.dat as of IERS Bulletin C 72. Each row is the last second of a UTC day, and the number is TAI − UTC after it.

Inserted secondTAI − UTC after
1972-06-30T23:59:60Z11
1972-12-31T23:59:60Z12
1973-12-31T23:59:60Z13
1974-12-31T23:59:60Z14
1975-12-31T23:59:60Z15
1976-12-31T23:59:60Z16
1977-12-31T23:59:60Z17
1978-12-31T23:59:60Z18
1979-12-31T23:59:60Z19
1981-06-30T23:59:60Z20
1982-06-30T23:59:60Z21
1983-06-30T23:59:60Z22
1985-06-30T23:59:60Z23
1987-12-31T23:59:60Z24
1989-12-31T23:59:60Z25
1990-12-31T23:59:60Z26
1992-06-30T23:59:60Z27
1993-06-30T23:59:60Z28
1994-06-30T23:59:60Z29
1995-12-31T23:59:60Z30
1997-06-30T23:59:60Z31
1998-12-31T23:59:60Z32
2005-12-31T23:59:60Z33
2008-12-31T23:59:60Z34
2012-06-30T23:59:60Z35
2015-06-30T23:59:60Z36
2016-12-31T23:59:60Z37

The table is closed. The General Conference on Weights and Measures (CGPM) decided in 2022 (Resolution 4) to let the difference between UTC and the rotation of the Earth grow past one second, and in 2026 (Resolution 5) that continuous UTC becomes effective on 20 May 2027. No insertion after 2016 is known and none is planned. A weekly check compares the table with the IERS file and fails if the two differ, so a row added by IERS shows up as a failed run.

taiMinusUtc(instant) returns the whole seconds TAI leads UTC by at an instant. Before 1972 UTC did not differ from TAI by whole seconds, so there is no integer and the function returns null. An integer written for all dates is wrong for every date before 1972.

import { taiMinusUtc } from "@northguild/gmt/timescale/calculate";
taiMinusUtc("1971-12-31T23:59:59Z");
// null
taiMinusUtc("1972-01-01T00:00:00Z");
// 10
taiMinusUtc("1999-08-22T00:00:00Z");
// 32
taiMinusUtc("2016-12-31T23:59:60Z");
// 36
taiMinusUtc("2017-01-01T00:00:00Z");
// 37

A second 60 is a real reading on the days of the table and an invalid one on every other day. hasSecond60 only asks whether the text has a 60 in the seconds place, so it accepts a day UTC never inserted a second on. isLeapSecond asks the table, and it reads any offset, because an inserted second is the same instant everywhere:

import { hasSecond60 } from "@northguild/gmt/plain/validate";
import { isLeapSecond } from "@northguild/gmt/timescale/validate";
hasSecond60("2017-12-31T23:59:60Z");
// true
isLeapSecond("2017-12-31T23:59:60Z");
// false
isLeapSecond("2016-12-31T23:59:60Z");
// true
isLeapSecond("2017-01-01T08:59:60+09:00");
// true

See A Leap Second That Never Happened. Every other function in the library rejects a second of 60, including isValidInstant.

leapSecondsBetween(start, end) counts the insertions in the half-open range from start up to but not including end. It is signed: the reverse order gives the negative. It returns null if either end is before 1972. nextLeapSecond(instant) returns the first insertion after an instant, or an empty string when there is none, as there is none after the last row of the table.

import { leapSecondsBetween, nextLeapSecond } from "@northguild/gmt/timescale/calculate";
leapSecondsBetween("2000-01-01T00:00:00Z", "2024-01-01T00:00:00Z");
// 5
leapSecondsBetween("2024-01-01T00:00:00Z", "2000-01-01T00:00:00Z");
// -5
leapSecondsBetween("2016-12-31T23:59:59Z", "2017-01-01T00:00:00Z");
// 1
leapSecondsBetween("1971-01-01T00:00:00Z", "2024-01-01T00:00:00Z");
// null
nextLeapSecond("2016-01-01T00:00:00Z");
// "2016-12-31T23:59:60Z"
nextLeapSecond("2024-01-01T00:00:00Z");
// ""

toTAI and fromTAI move an instant between the two scales. TAI has no second 60, so the inserted second maps to its own TAI reading, and the readings across it run without a repeat:

import { fromTAI, toTAI } from "@northguild/gmt/timescale/convert";
toTAI("2016-12-31T23:59:59Z");
// "2017-01-01T00:00:35 TAI"
toTAI("2016-12-31T23:59:60Z");
// "2017-01-01T00:00:36 TAI"
toTAI("2017-01-01T00:00:00Z");
// "2017-01-01T00:00:37 TAI"
toTAI("2017-12-31T23:59:60Z");
// ""
fromTAI("2017-01-01T00:00:36 TAI");
// "2016-12-31T23:59:60Z"

CCSDS 301.0-B-4 section 3.5 defines two text codes for a UTC instant. Code A is a calendar date, YYYY-MM-DDThh:mm:ss.d…dZ. Code B is a day of the year, YYYY-DDDThh:mm:ss.d…dZ. The Z is optional when a code is read, and the formatters always write it.

A second of 60 is read only where UTC inserted one. A code coarser than whole seconds names a span and not an instant, so it returns "". A code that is read keeps its fraction as sent, up to nine digits. A code that is written cuts the fraction to the digits you ask for and never rounds it, so the last second of a year stays in that year.

import { parseCcsdsAsciiA, parseCcsdsAsciiB } from "@northguild/gmt/timescale/parse";
import { formatCcsdsAsciiA, formatCcsdsAsciiB } from "@northguild/gmt/timescale/format";
parseCcsdsAsciiB("2016-366T23:59:60.5Z"); // "2016-12-31T23:59:60.5Z"
parseCcsdsAsciiA("1988-01-18T17:20:43.123456"); // "1988-01-18T17:20:43.123456Z"
formatCcsdsAsciiA("2024-06-15T16:30:00+02:00"); // "2024-06-15T14:30:00Z"
formatCcsdsAsciiB("2026-12-31T23:59:59.9999999Z", 3); // "2026-365T23:59:59.999Z"

Terrestrial Time (TT) is TAI plus a fixed 32.184 seconds (IERS Technical Note 36, section 10.1). It is the time argument an Earth ephemeris takes, so TT − UTC follows the leap-second steps: it was 42.184 seconds at the start of 1972 and has been 69.184 seconds since the end of 2016. toTT and fromTT move an instant between UTC and a TT label, through the same table as toTAI.

Geocentric Coordinate Time (TCG) differs from TT by a rate, not by a label. IAU 2000 Resolution B1.9 fixes TCG − TT at zero at 32.184 seconds past midnight on 1977-01-01 TT, and the gap grows by a constant fraction of every second after that. It is negative before 1977 and has grown by about 22 milliseconds a year since. toTCG and fromTCG apply it, and tcgMinusTt is exported so that a caller sees the size of the gap and not only the label it makes.

Before 1972 there is no whole-second TAI − UTC, so every one of these returns the sentinel: "" for the converters and null for tcgMinusTt.

import { tcgMinusTt } from "@northguild/gmt/timescale/calculate";
import { fromTCG, fromTT, toTCG, toTT } from "@northguild/gmt/timescale/convert";
toTT("2026-01-01T00:00:00Z");
// "2026-01-01T00:01:09.184 TT"
toTCG("2026-01-01T00:00:00Z");
// "2026-01-01T00:01:10.261661917 TCG"
tcgMinusTt("2026-01-01T00:00:00Z");
// 1.077661917
tcgMinusTt("1976-12-31T23:59:45Z");
// 0
tcgMinusTt("1971-01-01T00:00:00Z");
// null
toTT("1971-01-01T00:00:00Z");
// ""
fromTT("2026-01-01T00:01:09.184 TT");
// "2026-01-01T00:00:00Z"
fromTCG("2026-01-01T00:01:10.261661917 TCG");
// "2026-01-01T00:00:00Z"

The Terrestrial Time Stack draws the three pieces of the gap as one bar, and plots tcgMinusTt across the years.

Elapsed seconds against the clock difference

Section titled “Elapsed seconds against the clock difference”

Two UTC readings two hours apart on the clock are 7201 seconds apart in elapsed time when an insertion falls between them. spanNs subtracts readings as written, so on UTC readings it misses the inserted second. It returns null for a reading with a second of 60, which it cannot place on a straight line. Give it the TAI readings of the same instants and the inserted second counts:

import { spanNs } from "@northguild/gmt/span/calculate";
spanNs("2016-12-31T23:59:59Z", "2017-01-01T00:00:00Z");
// 1000000000n
spanNs("2016-12-31T23:59:60Z", "2017-01-01T00:00:00Z");
// null
spanNs("2016-12-31T23:00:36Z", "2017-01-01T01:00:37Z");
// 7201000000000n

The last call is the span between the TAI readings of 2016-12-31T23:00:00Z and 2017-01-01T01:00:00Z, written with a Z because spanNs reads one. The two UTC instants are two hours apart on the clock and 7201 seconds apart in elapsed time. See Mistakes: leap seconds.

  • The Leap Second Timeline draws every insertion, and the integer-seconds era before and the continuous era after.
  • The Terrestrial Time Stack shows one instant on UTC, TAI, TT and TCG, with TAI − UTC, TT − TAI and TCG − TT as one bar and the growth of TCG − TT across the years.
  • Elapsed vs. Clock Difference shows the clock difference and the elapsed seconds of two readings side by side.
  • The CCSDS Time Code Decoder reads a Code A or Code B text and shows the inserted second at 2016-366T23:59:60.5Z.
  • The Code B Day Ruler reads one Code B day in two years and draws each year’s months on one scale, so the leap-day shift and the missing day 366 show.
  • IERS, Leap_Second.dat, and Bulletin C 72.
  • ITU-R Recommendation TF.460-6: the standard-frequency and time-signal emissions, with UTC defined from 1972.
  • CGPM 2022, Resolution 4, and CGPM 2026, Resolution 5, on the future of UTC.
Accessibility
© 2026 NorthGuild · Licences

Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.