SAC13 leap year rule
Example
Let’s find out if 12’033 is a leap year:
- 12’033 + 199 => 12’232
- 12’232 mod 293 => 219
- 219 mod 33 => 21
- 21 mod 4 => 1
- The result is 1, so it’s a leap year
Why is the leap year rule the way it is?
A year is not exactly 365 days long - it’s a bit longer. This is why there are leap years and (solar) calendars typically have leap year rules to match the length of the year. The main goal of SAC13’s leap year rule is to keep the March equinox as close as possible to the start of the year (1st March 00:00 UTC), and to do that, we need to first find out how long a year really is.
The long story is complicated, and the short story is that there are multiple different “years”, and all of them mean slightly different things. The two main distinctions are the Sidereal year and the Tropical year. Solar Calendars try to match the Tropical year, but even here there are important differences, because the mean tropical year and the vernal equinox year are slightly different and depending on the calendar’s goals it’s important what to choose as a target. Many calendars aim to anchor the March equinox to a specific date or near the start of the year but most other calendars (even new modern proposals) get it wrong and try to track the mean tropical year, which causes the March equinox to slowly drift away from the intended position.
The length of the March (vernal/northward) equinox year, which SAC13 tries to match, is approximately 365.24237404 days. This length actually changes and is (very, very!) slowly getting longer, but that doesn’t really matter in practice. To make that into a leap year algorithm, one typically uses continued fractions and similar tools to find good rational approximations with small denominators and then construct cycles with that.
The main idea behind the SAC13 leap year algorithm is a $ \frac{71}{293} = 0.2423208… $ cycle (meaning 71 leap years over a period of 293 years), which itself consists of eight $ \frac{8}{33} = 0.\overline{24} $ cycles and one $ \frac{6}{25} = 0.2413793… $ cycle. That’s where the magic numbers “293” and “33” come from. Now that the frequency of the leap years is set, we have to determine the offset - the number that is added in the first step - so we actually leap around the correct time. Because the big cycle is 293 years long, there are several options. So I checked all the offsets against this model (actually a Rust port of it) and picked the one that had the most matches in some thousand years. The match evaluation function was also weighted, so that matches in the more distant future are less important, because the model is a polynomial and is only valid up until the year 3000 and I didn’t want to pick an offset that tries to match a model outside its valid range. The offset that fell out of this process was “199”, and that’s where this magic number came from.
Because SAC13 leap years are calculated and not measured there will be close calls (when the March equinox is close to 12:00 UTC) where the year doesn’t start on the closest day to the March equinox, but on the second closest day, because of unforeseen shifts and the simplicity of the leap year rule. This level of accuracy is far above the Gregorian Calendar and probably more than enough for any civil and many scientific use-cases.
This leap year rule likely works for a few millennia without any change.
Why not use a simpler leap year rule?
SAC13 tries to closely align the year with the seasons. That’s not really possible with very simple rules like in the Gregorian Calendar. When the Julian, and later the Gregorian, Calendar was invented it was important that it’s easy to calculate if a given year is a leap year. There were no computers or calculators and it thus was of great value that you could tell, just by looking at a year, if it’s a leap year or not.
Today, I believe the only people who really think about leap years are people with a special connection to leap days, for example, because of a birthday, wedding day, etc., or because someone coincidentally saw the 29th February on their mobile phone calendar.
March equinox rule-based vs measured
SAC13 is not the only calendar that tries to start the year close to the March equinox. The Solar Hijri calendar for example is even used as the official calendar in Iran and also starts with the March equinox. It’s often considered to be the most accurate calendar and in a way that’s actually true, because they don’t have a leap year rule at all. The March equinox is measured to determine which years are leap years. Typically this can be done many years into the future, but there are situations where the March equinox is close to a “tipping-point”, where only minutes or even seconds can make a difference if a year is a leap year or not. In a worst case scenario this could change a year retroactively.
Let’s imagine (just an example, and numbers are made up, and we use UTC instead of UTC+03:30) we are currently in the year 100 and the prediction of the next March equinox for the start of year 101 is 11:59 (UTC). Because of that year 100 will be a common year (365 days) because 11:59 is closer to UTC 00:00 on day 365 than UTC 00:00 on day 366. We continue living through the year 100 when updated astronomical measurements during the last quarter of the year show, that the March equinox will actually be at 12:02 UTC. Now we have a problem, because we have to retroactively make the year 100 from a common year to a leap year and everything that happened during that year after the leap day has to be shifted by one day. In practice, nobody in their right mind would shift the dates around during a year and just live with the fact that the start of the next year isn’t as close as it could have been to the March equinox.
Leap year patterns that are derived from measurement also have the big issue that automated systems and software have to constantly be kept up to date with leap year lists or “cheat” and use an algorithmic approach anyway, which has the bonus downside that there is no agreed-upon standard on which algorithm to use because the calendar, per definition, uses measurements instead of algorithms.
That’s why SAC13 uses rule-based leap years. The rule is accurate enough to keep the calendar stable for a very long time, it’s unambiguous and even easy to implement on 8-bit microcontrollers without heap allocations, and every few hundred years we might leap a year too early or too late but it doesn’t matter, because everybody will agree on which years are leap years and which years are not.
Difference between Sync Day, Leap Day and Year Day
Every 29th is a sync day, so Leap Day is a sync day, and Year Day is also a sync day. All years, common years with 365 days and leap years with 366 days have a Year Day on 29th Addenduary. Leap years have an additional sync day, namely the Leap Day on 29th August.