3 ms·
Leap years are defined by a known algorithm: If the year is evenly divisible by 4, then it's a leap year, unless it's divisible by 100, unless it's divisible by
by dodedo 15y ago
Leap years are defined by a known algorithm: If the year is evenly divisible by 4, then it's a leap year, unless it's divisible by 100, unless it's divisible by 400. This defines all future leap years. Because of this, we /do/ know how much time will be between two particular dates. Leap years can be calculated in advance as they represent a well-known, fixed skew between the gregorian calendar and the actual calendar.
Contrast this with leap seconds, which represent a variable skew and cannot be predicted by algorithm. Leap seconds are determined by measurement of the solar cycle and are merely announced at 6 month intervals. Because of this we cannot use solar time with seconds-granularity more than 6 months into the future, and a table of past leap-seconds is needed to accurately calculate time in the past. Worth noting: POSIX time functions do none of this for you.
There is another system of time, TAI, which is used for scientific measurements which rely on seconds-granularity at arbitrary intervals. TAI is skewed from solar time and will eventually not match the 24 hour solar cycle.