Leap Day is a Big Hack

Our Earth makes a complete revolution around the sun every 31,556,956 seconds. This means a year is truly 365 days, 5 hours, 49 minutes and 16 seconds. However, the average of the true solar day is 86,400 seconds, or 24 hours. The length of the solar day also has variation depending on the orbital motion of the Earth, but the average is 86,400 seconds. When you do the math and divide 31,556,969 by 86,400, you end up with some left over time, which is what causes Leap Year. Leap Year was created to maintain our seasonal calendar and prevent seasons from drifting, for example, Winter in July. Leap Year takes the remainder 5 hours, 49 minutes and 16 seconds, rounds it to 6 hours, accumulates it, and every 4 years, the 24 hours of accumulated time is tacked onto the end of February, Leap Day, Feb 29th.

Now if you were paying attention, you caught that we cheated a little and we rounded the 5 hours, 49 minutes and 16 seconds up to 6 hours. What happens to the leftover 10 minutes and 44 seconds?

Leap Year Misunderstood

A common misconception is that Leap Year occurs every 4 years. For most of us reading this, we can go on believing that Leap Year occurs every 4 years because that’s how we’ll see it for the rest of our lives. However, for those that make it to 2100, you won’t see a Leap Year in 2100, even though 2100 is divisible by 4. Why? Every 134 years, the left over 10 minutes 44 seconds accumulates into a full day. To account for that, only years that are divisible by 4 and not divisible by 100 is a Leap Year. 2100 will not be a Leap Year.

If you look back at the 2000 calendar, there was a February 29th. Two thousand is divisible 4 and 100, therefore it shouldn’t have been a Leap Year. What’s going on? Well, we have another math problem. Every 134 years that leftover time makes a full day, but we compensate every 100 years, so we end up with a 34 year deficit that gets handled by another rule. This rule states that if the year is divisible by 4 and 400, ignore the previous rule and add a Leap Day. Now if you are still tracking with me, you may be thinking that this math doesn’t solve the problem and there still seems to be some time left over after all of those hacks and adjustments. If you are thinking this, you are correct.

The purpose of Leap Year is to keep seasons lined up with our calendar. Keeping the vernal equinox on or close to March 21st is the objective. This Superman III, Salami Slicing means that in 8,000 years, the calendar will be one day behind. There have been suggestions to help with this too. Some think that by the time this occurs, the length of the vernal equinox will have changed. Unfortunately, the Cone of Uncertainty is at play and this far out the change to the vernal equinox cannot be accurately predicted. As a result, the current series of Leap Day hacks will have to do. Others like John Herschel have suggested that we need another hack in the algorithm that would make the year 4000 a non-Leap Year. Who knows what this will look like by year 4000. By then I will long be forgotten, the Earth might not even exist and this Leap Year hack won’t concern me. However, if you’re a software developer like me, here’s a chunk of C# code to help you determine if a given year is a Leap Year.

bool IsLeapYear(int year)
   return (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0));

All of that Leap Day history is interesting and it’s interesting to know that something as central as our calendar has a big hack like Leap Day. But I now have a practical Leap Day question for you and it’s likely more important than this useless trivia.

What do you have planned for Leap Day 2012?

Leap Day 2012 is shaping up to be a day of announcements and product releases from Microsoft. My plan for Leap Day includes downloading and installing the Windows 8 Consumer Preview, Visual Studio 11 Beta, taking a certification exam, tuning in to hear announcements from Mobile World Congress and following the MVP Summit 2012 buzz on twitter. The following is the list of the Leap Day 2012 items that I’ll be paying attention to with links for more information and downloads.

Mobile World Congress – Windows 8 & Windows Phone Announcements

Windows 8 Consumer Preview

Visual Studio 11 Beta

MVP Summit 2012

What’s on your list for Leap Day 2012?