# The Mathematics of Leap Years and Leap Seconds Explained

To keep our Gregorian calendar in sync with mean solar time (UT1 time scale), we need to add a second once in a while in addition to adding a day every four years. However, the algorithm is even more complex than that, as I'll explain below.

### My Background With This

As a Computer Systems Programmer, I once had to write an algorithm to determine the day of the week (Monday, Tuesday, etc.) for any specific calendar day. That required me to have a thorough understanding of how we calculate the days of our calendar.

## How We Achieve Accurate Time Measurements

We live in a time when we have the resources to do extremely accurate measurements. We have the technology to measure the Earth's rotation so precisely that we can detect how it is slowing down. We use atomic clocks to keep an accurate account of time.

There are National Standards Agencies in many countries that maintain a network of atomic clocks. They are kept synchronized with extreme accuracy.

In addition, we have the master atomic clock at the U.S. Naval Observatory in Washington, providing the time standard for the U.S. Department of Defense.

The NIST-F1, a cesium fountain atomic clock developed at the NIST laboratories in 2013 at Boulder, Colorado, is more accurate than previous atomic clocks.^{1}

## Managing The Extra Fractions of Days

If it takes exactly 365 days for the Earth to revolve around the Sun, then we would have a perfect calendar, and we would not need to make corrections.

If a year had 365 and a quarter days precisely, then adding a day every four years would work wonderfully. Unfortunately, our Earth goes around the Sun in 365.2426 days, so adding a day every four years would be adding too much.

We add an extra day, February 29th, every four years. However, we need to skip that addition once in a while for the following reasons.

If that additional fraction over 365 days were exactly a quarter of a day (.25), then every four years would add up to a full day precisely. If that were the case, we would merely add that extra day at the end of February every four years.

However, since the Earth revolves around the Sun slower than that by a tiny fraction, we need to skip some Leap Years. Let's examine the details mathematically.

## We Need to Skip a Leap Year Every 100 Years

That fraction I mentioned before, 0.2426, is a little less than a quarter of a day. Therefore, every 100 years, we need to skip adding a day in February. Otherwise, we would be adding too much.

Skipping a leap year every 100 years would only be accurate if the extra time were precisely 0.25. However, we are still off by almost .01 from a quarter day. That .01 adds up to 1 in 100 years. Therefore, we need to skip a leap year every 100 years. If we didn't, we'd be adding too many days to the calendar.

But wait! That still isn't perfect! We'll still get out of sync with solar time if we don't take it a step further.

## We Need to Add an Extra Day Every 400 Years

As you can see, we still have that extra .0026 that we are off when skipping a leap year every 100 years. If you add that up, with some rounding error, that .0026 is a little over one day every 400 years (.0026 x 400 = 1.04).

That means that skipping a leap year every 100 years needs adjustment as well. We need to add a day back in. We need to keep that leap year every 400 years to get that one extra day added back.

The easiest way to add that missing day back in is "*not to skip"* a leap year when the year is a multiple of 400. In other words, we keep February 29th on the calendar every 400 years, even though it is a multiple of 100.

## To Put It in a Sentence

To say it all in one sentence: We add a day every four years, but not every 100 years, unless it’s a fourth century year, at which point we *do* add that extra day anyway.

But there's more involved! Besides adding days, we need to add seconds every so often. I'll explain that next.

## Table of Leap Years and Reasons for It

Year | Skip Leap Year if Multiple of 100 | Unless it's a Multiple of 400 | Leap Year? |
---|---|---|---|

1600 | - | Yes | Yes |

1700 | Yes | No | No |

1800 | Yes | No | No |

1900 | Yes | No | No |

2000 | - | Yes | Yes |

2004 | No | - | Yes |

2008 | No | - | Yes |

2012 | No | - | Yes |

2016 | No | - | Yes |

2020 | No | No | Yes |

2024 | No | No | Yes |

2100 | Yes | No | No |

## Leap Seconds Are Needed Too

That mathematical formula for leap years is still not perfectly accurate, and we need to add a few seconds once in a while to compensate for the following events:

- Climate and geological events can cause the Earth’s revolution around the Sun to fluctuate.
- The Earth's rotation around its axis is not consistent either. It tends to slow down and speed up ever so little.
- Earthquakes can cause fluctuations that change the length of a day by a tiny amount. For example, a 9.0 magnitude Earthquake in Japan in 2011 had shifted the Earth's axis by 16.5 cm (6.5 inches).
^{2}

To improve the accuracy of our time clocks, we need to adjust our calendar by adding a second or two every year. It’s called a leap second.^{3 }

Scheduling the addition of an extra second to a year, when needed, is done to make these adjustments. It's usually added as an additional second just before midnight (23:59:60), Coordinated Universal Time (UTC), on June 30th or December 31st.

## Prior Leap-Second Time Adjustments

The *International Earth Rotation and Reference Systems Service* is the agency that decides when to make leap-second time adjustments. They apply a leap second whenever necessary to keep our clock from being more than 0.9 of a second off.

Here is a table of dates when an additional second was added. Each addition was at midnight (UTC):

- December 31, 2008
- December 31, 2005
- June 30, 2012
- June 30, 2015
- December 31, 2016
- June 30, 2018
- June 30, 2020

## In Conclusion

It's an ongoing struggle to keep our time measurements accurate since physical events like earthquakes can nudge the Earth just enough to require adjustments.

With the present technology, we have the means to keep our clocks in sync with the way we represent time.

## References

- Physical Measurement Laboratory. (October 19, 2018).
*“NIST-F1 Cesium Fountain Atomic Clock.”*NIST Time and Frequency Division - Michael Winter (March 14, 2011). "Quake shifted Japan coast about 13 feet, knocked Earth 6.5 inches off axis".
*USA Today* - James Jespersen, Jane Fitz-Randolph. (1999).
*From Sundials To Atomic Clocks: Understanding Time and Frequency*(PDF). National Institute of Standards and Technology. p. 110.

**© 2012 Glenn Stok**

## Comments

**Glenn Stok (author)** from Long Island, NY on July 29, 2018:

mr-d115 - That’s great work you did on the analysis, and a good catch.

Assuming nothing else is affecting the numbers, that .96 hour lost every 400 years is equivalent to 10 seconds per year. Therefore adding one second every year is not enough, as you are pointing out.

There is another piece to the puzzle that needs to be included in your calulations. The Earth's rotation is slowing down. In 400 years that’s another .006 seconds, which I admit isn’t close the the 10 second loss you calculated, so your question remains a pertinent consideration.

There is one other thing. The period of the Earth's rotation is slightly irregular. So more needs to be considered in the calculation.

As a last straw, more leap seconds can always be added. One every other month over a 400 year period will put your calculation in sync. But that’s only necessary if nothing else is affecting the calculation, as I mentioned at the start of my reply.

Interesting discussion. Thanks for your worthy comment and effort.

**mr-d115** on July 28, 2018:

The calculation .0026 x 400 = 1.04 shows that we fall behind by 1.04 days every 400 years and explains why we need to add an extra leap day every 400 years. But what about the .04 days that we still fall behind every 400 years. .04 x 24 hours = .96 or about 1 hour every 400 years. You indicated a concern for compensating for lost seconds with leap seconds. Is any compensation made for that lost .96 hour every 400 years?

**Kristen Howe** from Northeast Ohio on July 18, 2015:

My pleasure Glenn. I always wondered about the leap year and never heard of leap seconds.

**Glenn Stok (author)** from Long Island, NY on July 18, 2015:

Kristen Howe - It sure is interesting. The Earth's rotation is slowing down, requiring the addition of leap seconds. Thanks for the vote up. Much appreciated.

**Kristen Howe** from Northeast Ohio on July 18, 2015:

Glen, this was real interesting to know we had a extra leap second last month and next year is a leap year. This was well-written and intriguing to know the history behind the leap year. Voted up!