Well, the world didn’t come to an end in the year 2000, and it didn’t come to an end in 2012, but we’re definitely going through some sort of strange transition of eras, and guess what, we have another end of the (UNIX) calendar in less than 15 years, and that’s going to impact everyone that uses 32-bit signed UNIX timestamps.
Hopefully I’ll be alive to see that end of the world, but then guess what, there’s a Y2100 problem, I just remembered while reviewing this RISC OS code. I’m hoping that the younger programmers are ambitious enough to want to still be around when a bunch of calendar calculations end up off by a day because 2100 isn’t a leap year, and neither was 1900, but 2000 was a leap year.
This code is just checking if the year is divisible by 4, which works for 2000 but not 1900 or 2100. There’s a lot of date handling code that checked if the year was divisible by 4 or by 100, because that works for 1900 (and 2100) but not 2000 (which is divisible by 400, which is the third rule you need to know). That was a Y2K-related issue that got less attention than the code that was using only two digits to store the year (in decimal).
Leave a Reply