why is this different from leap years?
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.