On New Year’s Eve 2016, the world’s timekeepers will extend the year by exactly one extra second. Official clocks will hit 23:59:59 as usual, but then they'll say 23:59:60, before rolling over into 2017.

This is known as a "leap second," and timekeepers slip them in periodically to keep our clocks in sync with the Earth’s rotation. They do this because it technically takes Earth a bit longer than 24 hours to complete a full rotation — 86,400.002 seconds rather than 86,400. So in order to keep our clocks matched up with solar noon, when the sun is highest in the sky, a leap second gets added every few years.

In fact, this adjustment is quite common: Since the practice began in 1972, fully 27 out of 44 years have included leap seconds. The last one occurred on June 30, 2015.

In practical terms, this won't affect most people’s lives very much. Though a previous leap second in 2012 caused a glitch in the software running Reddit, Gawker, and other websites, most systems were far better prepared for the leap second in 2015.

The reasons for the leap second, though, are pretty fascinating — and they reveal some underappreciated facts about the difficulty of precise timekeeping on this spinning chunk of rock we call Earth.

When does the leap second happen?

It depends what time zone you’re in. For those living in Coordinated Universal Time — the world's official time standard, based off atomic clocks and used to calculate the times around the world — the leap second will happen on December 31 just after 23:59:59. Clocks will move to 23:59:60 before moving on to 00:00:00 the next day. Revelers in the United Kingdom will have to adjust their New Year's countdown accordingly.

If you’re living in the East Coast United States, the leap second will happen on December 31 at 18:59:59. And so on.

What should I do with my clocks?

You don't have to do anything. People who write timekeeping software have had to go to lots of trouble to make sure the leap second doesn't cause any glitches, but you're all set. Enjoy the extra time and contemplate the cosmos.

Devices that set their times automatically — like phones and computers — will adjust on their own. And you really don't have to worry about your other clocks, because a one-second difference between their time and official time is probably too small for you to notice.

Why do we need a leap second?

This is where it gets interesting. As it turns out, all sorts of factors, including tides and melting glaciers, cause the rate of Earth's rotation to vary slightly over time (more on that below).

"Lots of people think the Earth's rotation is a simple, 24-hour thing," Steve Allen of the University of California's Lick Observatory told us last year. "But weather in the atmosphere, in the ocean, and in the core of the Earth make it complicated."

Historically, this variation didn't really matter, as the world's official clocks were based off Greenwich Mean Time, which in turn is based off the time when the sun is highest in the sky in Greenwich, London. We set our clocks based on the position of the sun (and thus, the rotation of Earth) and didn't really notice when it varied by a fraction of a second.

In 1967, though, most countries switched over to Coordinated Universal Time (UTC), which is based off atomic clocks that run with extreme precision. (The basis of their seconds is the frequency at which electrons surrounding an atom jump from one energy level to another.)

That created a problem: This new standard defined a second as 1/86,400th of an average day — but that was based on the estimate of an average day in 1900. The problem is that days have generally been a bit longer since then, as the Earth’s rotation has slowed, and so a discrepancy has formed between solar time and official time.

The difference is very small, amounting to less than a second per year. But if we didn't start using leap seconds to account for it, the two clocks would now be nearly 30 seconds apart. Eventually, over centuries, this could lead to the sun reaching the highest point in the sky minutes after official noon — and over millennia, the gap could get hours long.

So as a solution, timekeepers in the International Telecommunications Union (ITU) — the United Nations agency that manages UTC — stick in a leap second whenever the difference between the two clocks threatens to exceed 0.9 seconds. They determine when to do this based off the observations of astronomers who carefully measure Earth's rotational speed by looking at distant quasars in the sky/universe:

The official rules dictate that leap seconds can be inserted up to twice a year (on June 30 and December 31), always at 23:59:60 UTC. The timekeepers can also subtract a second, but that has never been necessary so far, as Earth's days have generally been longer than 86,400 seconds, not shorter.

Are some timekeepers opposed to the leap second?

Yes! As you might imagine, this sort of ad hoc process bothers some people who devote their lives to keeping time as precisely and consistently as possible — and it presents a practical problem for people who write software that involves time, which is to say virtually all software running on every computer.

Leap seconds were originally devised with sailors in mind, who at the time used the position of the stars to navigate and thus wanted Earth's rotation to roughly matching up with official time. Now, however, ships use GPS — and the GPS time system, in fact, doesn't use leap seconds at all, so it's constantly drifting away from both UTC and solar time.

As such, in 2005 American members of the ITU proposed to abolish the leap second. Their plan called for leap hours rather than leap seconds, allowing UTC to drift as much as an hour away from solar time. In practice, this would have decoupled the two clocks, as it'd take thousands of years for an entire leap hour to be necessary.

The proposal wasn't formally submitted, but other countries have presented similar ideas, and the debate has continued within the ITU over the years.

Why does Earth's rotation vary over time?

There's a whole array of complex reasons that Earth doesn't spin at a constant rate. Anything that alters the distribution of its mass affects its speed.

Long-term factor: Tidal friction

Over the longest time scales, the main factor at play is a phenomenon called tidal friction. As the moon orbits around Earth, its gravity pulls at our oceans, creating two bulges of water that rotate around the planet, called tides.

But these bulges aren't oriented directly underneath the moon. They're slightly ahead of it, in terms of the direction of Earth's rotation. As a result, the Earth's crust encounters just a bit of friction from this bulge of water as it rotates, slowing it down slightly.

Over time, this has slowed down the planet dramatically: About 4.5 billion years ago, it took the Earth just six hours to complete one rotation. About 350 million years ago, it took 23 hours. But over time, it's grown by about one to two milliseconds every century.

Long-term factor: glaciers melting

The other big long-term factor is the melting of glacial ice. "During the last ice age, the weight of ice sheets in North America and Antarctica pushed mantle mass very slightly toward the equator," Ryan Hardy, a PhD student in geodesy at the University of Colorado, explained last year. Over the past 12,000 years or so, though, that ice has melted, causing the land below it to spring back up very slightly (currently at rates of a centimeter or so per year in these polar regions).

This means there's slightly more mass at the poles and less at the equator, bringing more near the planet's axis. This causes it to spin a bit more quickly — and an average day to shorten by about 0.6 milliseconds every century. Climate change is projected to further shorten the length of a day by about 0.12 milliseconds over the next two centuries as glaciers melt even further.

Shorter-term factor: outer core activity

Over the course of decades, geologic activity within Earth's outer core can speed up or slow down the length of a day by a few milliseconds. This layer of molten rock — situated between the solid inner core and the semi-solid mantle — rotates slightly faster than the rest of the planet. The flow of this liquid rock alters the transfer of momentum to the mantle and crust and, as a result, the Earth's measured rotation speed. But this variation and its relationship to the Earth's speed isn't well-understood.

Even shorter-term factors: wind, tides, storms, and more

At shorter time scales, a huge variety of factors can alter the length of a day by around 0.2 to 0.3 milliseconds.

Seasonal changes in wind speed, for instance, can sap slight amounts of the planet's rotational momentum. If the atmosphere as a whole is moving primarily from west to east, for instance, this effect will slightly slow down the rotation of the planet underneath it as it turns in the same direction. Ocean currents can do the same.

Tides also cause a number of distinct cycles in the length of a day — at 12-hour, daily, fortnightly, monthly, every six months, every year, and 18.6 year frequencies — by subtly changing the shape of the Earth. This is distinct from their longer-term tidal friction effect. The 12-hour variations, for instance, are due to each day's two high tides and low tides. The longer-period variations are linked to subtler, longer-term cycles in tides that are caused by gravity exerted by the sun and Jupiter.

Finally, there are random, sporadic events — such as giant storms — that may alter the distribution of mass throughout the Earth enough to change its rotation speed. It's been hypothesized that earthquakes could do the same, but that hasn't been proven yet.