How the Year 2038 bug could disrupt your digital life – and what you can do
The software issue affects systems using Unix time, which stores time as seconds since 1970.
Imagine it is January 19, 2038. You are using your smartphone when you are suddenly logged out of several applications, and the phone system crashes. In the news are reports on bank transaction failures and grounded flights.
This may sound like a plot from a sci-fi disaster film, but the “Year 2038” bug is a very real threat that could disrupt our digital world. The Year 2038 bug is a computer software issue that affects various systems using Unix time format. These systems will not be able to process dates and times after January 19, 2038, 03:14:07 UTC.
To understand why this could happen, we need to look at how computers store and interpret dates and times.
What is Unix time?
Unix time is a standard used in a wide range of computer systems, including operating systems, file systems and databases. It measures time as the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC.
UTC, or Coordinated Universal Time, is the global standard for timekeeping.
It is based on a 24-hour clock that starts at midnight at the Prime Meridian, an imaginary line that runs through Greenwich, England. The time in Hong Kong is eight hours ahead of UTC.
The developers who created Unix chose January 1, 1970, as the starting point for measuring time because the system was made in the late 1960s and early 1970s.
This specific moment is also considered the starting point, or “epoch”.
Hong Kong educators, tech industry leaders discuss AI at Principal’s Forum
Each second that passes after the epoch increases the Unix time value by 1. A negative value is used when counting backwards from the epoch.
Traditionally, Unix time is stored as a signed 32-bit integer. A signed 32-bit integer is a data type that can store positive and negative whole numbers. Its “bits” are binary, which is a system that uses either 0 or 1 to represent values.
The smallest value that this system can represent is -2,147,483,648, and the largest is 2,147,483,647 (see graphic).
This also means Unix time can cover 2,147,483,648 seconds before and 2,147,483,647 seconds after January 1, 1970, 00:00:00 UTC. This translates to a date range from December 13, 1901, 20:45:52 UTC, to January 19, 2038, 03:14:07 UTC.
How does a signed 32-bit integer cause the Year 2038 problem?
In the case of Unix time’s maximum value, January 19, 2038, 03:14:07 UTC, adding one more second would result in a time jump back to December 13, 1901.
This is what creates the Year 2038 problem. But why does this happen?
In binary, adding 1 to 1 results in 10. So if we add 1 to the 1 in the rightmost bit, the rightmost bit becomes 0, and the extra 1 carries over to the next bit on the left.
This continues carrying over until it eventually reaches the leftmost bit – this is called the sign bit. The integer is completely flipped when it reaches this point, taking the system back to the smallest value.
Because many computer systems rely on accurate time calculations, this could lead to disruptions in critical areas like transport, banking and power facilities.
How can we fix this?
One solution being implemented in many systems is to increase the bits that are used to store time information; this allows systems to keep track of time for a more extended period.
However, older systems and devices that cannot be updated, such as factory machines, medical devices and household appliances will be more challenging to fix.
The good news is that computer experts have long been aware of this issue and are working to fix it.
That said, it is probably a good idea to replace your old appliances – like an old washing machine – before January 19, 2038, if you want clean clothes that day.
Young Post has partnered with Hong Kong Science Museum and Hong Kong Space Museum to encourage your pursuit of science. Every month, the museums answer questions about the world around us, the cosmos and beyond.