Some of us might remember the Y2K problem and the hype around it.
Depending on who you talk to, it was either the biggest scam of the millennium or it was one of the best promoted tech-awareness campaigns ever.
The Y2K problem happened when programs only stored the last 2 digits of a year in a date. This was to conserve memory space in the good old days when memory was an issue and programmers had to find shortcuts to cram programs into small systems.
Fortunately, by the time 2000 rolled around the number of programs that would fall to the Y2K bug were rare and those that were vulnerable were rewritten or replaced.
Save for a handful of isolated incidents, nothing happened.
Now we have another programming wrinkle coming up in 18 years time. It is the Y2038 problem and affects programs that store the date as a serial number in a certain way.
These programs are using a 32 bit signed integer to store a value that represents date and time.
What this means is that a binary number of 32 places is being used to store a number that can be positive or negative. The positive or negative sign is the key here as it is stored on the far left of the binary number so it is only paying attention to the other 31 places.
If we use 31 binary places to count the number of seconds since 1st January 1970 (aka Unix Epoch) we run out of numbers at 2,147,483,647 (03:14:07 on Tuesday, 19 January 2038). If we use a 32 bit number, we wind up with the binary number 10000000000000000000000000000000 (2,147,483,648) but with the 31 binary places, the first binary digit is ignored and the date goes back to all zeros (1st January 1970). See the image below to see how this works.
This is a concern as the Y2038 problem impacts Unix or Linux systems that form a large part of the systems that power the internet, industrial systems, GPS systems even new technology like self driving cars, 3D printers and more. Any systems using 31 bits to store a date could potentially malfunction with unpredictable results.
Fortunately, we are seeing the warning signs here as some businesses are coming across these errors as they calculate values 18 years in the future and as a result we are able to start looking at ways to fix the problem.