📖 Guide

Time Units Explained: Seconds, Leap Years and Unix Timestamps

How the SI second is defined by a cesium atom, the leap year rule (divisible by 4, except centuries, except 400), and what the Unix timestamp counts.

Ad Slot — Top Banner

The Second Is Now Defined by 9,192,631,770 Vibrations

One SI second equals the duration of 9,192,631,770 periods of the radiation corresponding to the transition between the two hyperfine levels of the ground state of the cesium-133 atom. That definition, adopted in 1967, replaced the older astronomical second (1/86,400 of a mean solar day) because Earth's rotation is not perfectly stable. Atomic clocks based on this definition lose or gain less than one second in 300 million years.

The gap between atomic time and Earth's rotation time accumulates over years. To keep them aligned, international timekeepers add "leap seconds" to UTC (Coordinated Universal Time) when needed. Between 1972 and 2023, they added 27 leap seconds. In November 2022, the International Bureau of Weights and Measures voted to eliminate the leap second by 2035, which will let atomic time and solar time gradually diverge by up to a minute over the coming century.

This guide covers the full stack of time units from nanoseconds to years, the leap year rule with its century exception, the Unix timestamp and why it matters for software, and the structure of time zones and UTC offsets.

The Time Unit Hierarchy

Unlike metric length units, time units above the second do not follow base-10 rules. They follow the conventions of ancient Babylonian astronomy, which divided the day into 24 hours and each hour into 60 minutes because 60 is divisible by 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, and 30.

The standard relationships:

  • 1 minute = 60 seconds
  • 1 hour = 60 minutes = 3,600 seconds
  • 1 day = 24 hours = 1,440 minutes = 86,400 seconds
  • 1 week = 7 days = 604,800 seconds
  • 1 common year = 365 days = 8,760 hours = 31,536,000 seconds
  • 1 leap year = 366 days = 8,784 hours = 31,622,400 seconds
  • 1 Julian year = 365.25 days = 31,557,600 seconds (used in astronomy)

The Julian year (365.25 days) is the astronomical standard because it accounts for leap years over the long run. The light-year is defined using the Julian year: one light-year = 9,460,730,472,580,800 meters (the speed of light in m/s times 31,557,600 seconds).

Below the second, metric prefixes apply: 1 millisecond (ms) = 0.001 s; 1 microsecond (µs) = 0.000001 s; 1 nanosecond (ns) = 0.000000001 s. Computer processors measure cycle times in nanoseconds. Network packet transmission times in data centers run in microseconds.

The Leap Year Rule in Full

Earth orbits the Sun in about 365.2422 days (the tropical year). A calendar of 365 days drifts roughly 0.2422 days per year from the solar cycle. Julius Caesar introduced the Julian calendar in 46 BCE with a simple leap year rule: every fourth year gets an extra day. Over 400 years, the Julian calendar adds 100 days. But the real drift needs only 97 extra days per 400 years, not 100. The accumulated error caused the spring equinox to drift about 10 days from March 21 over 1,300 years.

Pope Gregory XIII fixed this with the Gregorian calendar in 1582. The Gregorian leap year rule has three levels:

  1. A year divisible by 4 is a leap year (2024, 2028, 2032...).
  2. Exception: a year divisible by 100 is not a leap year (1900, 2100, 2200...).
  3. Exception to the exception: a year divisible by 400 is a leap year (1600, 2000, 2400...).

Result: the year 2000 was a leap year (divisible by 400). The year 1900 was not (divisible by 100 but not 400). The year 2100 will not be. The Gregorian calendar has 97 leap years per 400-year cycle, producing an average year length of 365.2425 days. The remaining drift is about 26 seconds per year, meaning the Gregorian calendar will gain one day relative to the tropical year in about 3,300 years.

Quick check: Is 2100 a leap year? Divisible by 4: yes. Divisible by 100: yes. Divisible by 400: no. Result: not a leap year. Anyone building software that assumes "every fourth year is a leap year" will generate a bug in 2100.

Common Misconceptions

  • Every four years is a leap year. The century exception means 1900, 2100, 2200, and 2300 are not leap years. The "every four years" rule applies except at century boundaries not divisible by 400. The Y2K bug was about year formatting, but the 2100 leap year misassumption is a real, less-known software risk.
  • UTC is the same as GMT. Greenwich Mean Time (GMT) is a time zone. UTC (Coordinated Universal Time) is an atomic timescale. They are numerically close but different: GMT is based on solar time at the Greenwich meridian; UTC is based on atomic clocks adjusted with leap seconds. The difference is never more than 0.9 seconds, but they are not the same standard.
  • Time zones are always whole hours from UTC. India is UTC+5:30. Nepal is UTC+5:45. Iran is UTC+3:30. Australia's central zone is UTC+9:30. About 30 time zones worldwide use half-hour or quarter-hour offsets. Travel apps must handle sub-hour offsets or produce wrong local times.
  • A Unix timestamp is always positive. Unix time counts seconds since 00:00:00 UTC on January 1, 1970 (the Unix epoch). Dates before 1970 produce negative timestamps. January 1, 1960 has a Unix timestamp of −315,619,200. Modern systems handle negative timestamps, but older software may not.
  • A day is always 86,400 seconds. On days when a leap second is added, the day has 86,401 seconds. Some software systems handle this by "smearing" the extra second across the day (Google's approach). Others add it as second 61 of the final minute. Systems that assume exactly 86,400 seconds per day can fail on leap second insertion days.
Worked Example: Calculating Age in Seconds and Unix Time

David figures out exactly how many seconds he has been alive

David was born on March 15, 1990, at 08:00 UTC. He wants to know his Unix timestamp at birth and how many seconds he has been alive as of January 1, 2025.

Step 1: Find his Unix timestamp at birth. The Unix epoch is January 1, 1970 00:00:00 UTC. From 1970-01-01 to 1990-03-15 is 20 years and 74 days. Those 20 years include 5 leap years (1972, 1976, 1980, 1984, 1988), so: (20 × 365) + 5 + 74 = 7,379 days. Add 8 hours: 7,379 days × 86,400 s/day + 28,800 s = 637,588,800 seconds. David's Unix timestamp at birth is 637,588,800.

Step 2: Find the Unix timestamp at January 1, 2025 00:00:00 UTC. From 1970 to 2025 = 55 years. Leap years in that span: 14 (1972, 1976,..., 2024). Total days: (55 × 365) + 14 = 20,089 days. Timestamp: 20,089 × 86,400 = 1,735,689,600. (This matches the known Unix timestamp for 2025-01-01.)

Step 3: Age in seconds. 1,735,689,600 − 637,588,800 = 1,098,100,800 seconds. David is over one billion seconds old. He is 34 years and 292 days old at that point, which cross-checks: 34.8 years × 31,557,600 s/Julian year ≈ 1,098,000,000. Close enough given the Julian year approximation.

Ad Slot — In-Content

When Standard Time Calculations Break Down

  • Daylight saving time transitions. Clocks "spring forward" (skip one hour) and "fall back" (repeat one hour). A day in March may have 23 hours in DST countries; a day in November may have 25 hours. Software that assumes every day has 24 hours produces wrong results on transition days. Always work in UTC and convert to local time at display, never store local time in a database.
  • The Year 2038 Problem (Y2K38). Many systems store Unix timestamps as 32-bit signed integers, which overflow on January 19, 2038 at 03:14:07 UTC. After that point, the counter wraps to −2,147,483,648, representing December 13, 1901. Embedded systems, older databases, and legacy firmware may be affected. Migration to 64-bit timestamps extends the range to year 292,277,026,596.
  • Historical calendar differences. The Gregorian calendar replaced the Julian calendar in different countries at different times. Britain and its colonies switched in September 1752, losing 11 days. Russia switched in 1918, losing 13 days. Historical date calculations that cross 1582 (or 1752 for British records) must specify which calendar system applies.
  • Astronomical vs tropical year. The Julian year (365.25 days) and the tropical year (365.2422 days) differ by about 11 minutes. Over centuries, this matters for eclipse prediction and calendar drift. The Julian year is a fixed constant used in astronomy; the tropical year is a physical measurement that varies slightly as Earth's orbit changes.
  • Local solar time vs time zones. Time zones assign one offset to a large geographic area. At noon in New York (UTC-5 in winter), solar noon may be 12:07 or 11:54 depending on where in the zone you stand. Accurate sunrise/sunset calculations require longitude, not time zone. A time zone is a political boundary, not a solar alignment.

Quick Reference: Time Unit Conversions

UnitIn secondsIn minutesIn hours
1 second10.016670.000278
1 minute6010.01667
1 hour3,600601
1 day86,4001,44024
1 week604,80010,080168
1 common year (365 days)31,536,000525,6008,760
1 Julian year (365.25 days)31,557,600525,9608,766

Frequently Asked Questions

How is the second officially defined?

One second equals the duration of 9,192,631,770 periods of the radiation from a cesium-133 atom's hyperfine ground-state transition. This definition, adopted in 1967 and confirmed in the 2019 SI revision, makes the second reproducible by atomic clocks without reference to Earth's rotation. Cesium fountain clocks achieve accuracy better than 1 second in 300 million years.

Is 2100 a leap year?

No. Under the Gregorian calendar rule, years divisible by 100 are not leap years unless also divisible by 400. The year 2100 is divisible by 100 but not 400, so it has 365 days. The next century year that is a leap year will be 2400.

What is a Unix timestamp?

A Unix timestamp is an integer counting the number of seconds elapsed since 00:00:00 UTC on January 1, 1970 (the "Unix epoch"). As of January 1, 2025, the Unix timestamp is approximately 1,735,689,600. Every major programming language includes functions to get the current Unix timestamp and convert it to local time.

What is the difference between UTC and GMT?

UTC (Coordinated Universal Time) is maintained by atomic clocks and adjusted with leap seconds. GMT (Greenwich Mean Time) is a solar-based time standard at the Greenwich meridian. They differ by at most 0.9 seconds at any given moment. For practical scheduling purposes, they are interchangeable. For precise time measurement, only UTC is authoritative.

How many seconds are in a year?

A common year (365 days) has 31,536,000 seconds. A leap year (366 days) has 31,622,400 seconds. The Julian year (365.25 days) has exactly 31,557,600 seconds and is the standard used in scientific calculations and the definition of the light-year.

What time zones use offsets that are not whole hours?

Several countries use half-hour or quarter-hour UTC offsets. India is UTC+5:30. Nepal is UTC+5:45. Iran is UTC+3:30. Sri Lanka is UTC+5:30. Australia's Northern Territory is UTC+9:30. These offsets exist for geographic or political reasons and require explicit handling in software that assumes hourly offsets.

What happens to the Unix timestamp in 2038?

Systems using 32-bit signed integers for Unix timestamps will overflow on January 19, 2038 at 03:14:07 UTC. The counter wraps to a large negative number representing December 13, 1901. Modern 64-bit systems are not affected. The concern applies to legacy embedded systems, older POSIX C code, some database time columns, and network devices with 32-bit firmware.

Further Reading