Approximately every four years our calendars tack an extra day onto the month of February. It’s not random, it’s astronomy.

Leap days happen due to a mismatch between the number of calendar days and the actual time it takes for the Earth to orbit the sun. One calendar year is 365 days, but one solar year is technically 365 days plus 5 hours, 48 minutes and several dozen seconds.

“There's a quarter of a day in there,” Sky and Telescope senior editor Kelly Beatty explained on Boston Public Radio.

Humans have known about this mismatch since the days of Julius Caesar in 46 B.C., who decreed that the Romans observe a leap day every four years.

“This notion of leap days became ingrained in our calendar system. Every fourth year we catch up with an extra day, and then there's still a little residual,” Beatty said.

Then, 1,600 years after Julius Caesar, Pope Gregory XIII reformed the calendar and leap day system again, creating the Gregorian calendar that most of the world uses today.

In the Gregorian calendar, years that are the start of a new century are not leap years, even though they are divisible by four. But “every century divisible by 400, like the year 2000, does have a leap year,” said Beatty.

“It's confusing, but in the end it keeps our calendars … in sync with where the sun is in the sky,” said Beatty.