Leap Seconds and Their Effect on Epoch Timestamps

Understand how leap seconds affect Unix epoch timestamps and why most systems ignore them. Learn the difference between UTC, TAI, and POSIX time.

Countdown

Detailed Explanation

Leap Seconds and Epoch Timestamps

Leap seconds are one-second adjustments occasionally applied to UTC to keep it synchronized with the Earth's rotation. Since 1972, 27 leap seconds have been added. But how do they affect Unix timestamps?

The Short Answer

Unix epoch timestamps ignore leap seconds. The POSIX standard defines Unix time as the number of non-leap seconds since January 1, 1970. This means that a Unix timestamp does not account for the 27 leap seconds that have occurred, and a Unix day is always exactly 86,400 seconds.

How a Leap Second Works

On a leap second day, the clock goes:

23:59:58 UTC
23:59:59 UTC
23:59:60 UTC  ← leap second
00:00:00 UTC  ← next day

But in Unix time, the leap second is simply repeated:

23:59:58 → epoch N
23:59:59 → epoch N+1
23:59:60 → epoch N+1  (same value!)
00:00:00 → epoch N+2

UTC vs TAI vs Unix Time

System Handles Leap Seconds? Seconds Since 1970
UTC Yes N/A (not a timestamp format)
TAI Yes (no leap seconds in TAI, continuous) 1,705,312,237 (27 more than Unix)
Unix/POSIX No 1,705,312,200

Practical Implications

  1. Countdown timers: Leap seconds cause at most a 1-second discrepancy — negligible for almost all applications
  2. Log correlation: During a leap second, two log entries may have the same epoch timestamp
  3. NTP: Network Time Protocol handles leap seconds by either stepping or smearing the clock
  4. Google/AWS leap smear: Major cloud providers "smear" the leap second over 24 hours, distributing the extra second as tiny fractions throughout the day

The Future of Leap Seconds

In November 2022, the General Conference on Weights and Measures voted to abolish leap seconds by 2035. This means future systems will not need to handle them, and the discrepancy between UTC and TAI will be frozen.

Use Case

Reference this when building high-precision timing systems, analyzing log entries around leap second events, or answering questions about why Unix timestamps do not perfectly match UTC. For most countdown applications, leap seconds can safely be ignored.

Try It — Epoch Countdown

Open full tool