Happy leap day everyone! That's right, 2016 is a leap year, which means we get to enjoy a whole extra day of February, and people born on February 29 finally get some presents.

But why do we even have leap years?

Our calendar has 365 days in a year, because that's pretty much how long it takes the Earth to orbit the Sun. The problem is that in reality it takes the Earth around 365¼ days (actually 365.24219 days) to circle the Sun (that's a solar year), which means our calendar is out by around a quarter of a day a year.

That discrepancy was spotted a while back.

In 45 B.C. a decree by Julius Caesar began the practice of adding an extra day every four years, with the creation of the Julian calendar — making up for those quarter days.

That would be perfect if a solar year were exactly 365¼ days — but 365.242 is a teeny bit less than that, and over time that teeny bit adds up.

By 1582 A.D. that slight discrepancy in the Julian calendar added up to 10 days. So Pope Gregory XIII created the Gregorian calendar, coined the term "leap year" and established February 29 as the official date to add to a leap year. He also introduced a rule to take into account the discrepancy in the Julian calendar.

Now, a leap year occurs in every year that is divisible by four, but only in century years that are evenly divided by 400.

Therefore, 800, 1200 and 2000 were leap years - but 1700 and 1900 were not, because even though they are divisible by four, they are not divisible by 400.

So that fixes everything. Well, not entirely. The solar year is approximately 26 seconds shorter than the Gregorian year at the moment — but that's a problem for another day.