Back

Will Computers Stop in 2038? (The Y2K38 Problem)

At the end of 1999, the world feared the 'Y2K Bug'. Computers storing years as two digits (99) were expected to interpret 2000 as 1900, causing chaos.

Now, a similar, perhaps more serious problem is approaching.

It is the Year 2038 Problem.

1. Unix Time

How do computers store time? Most systems use Unix Time.

This counts the number of seconds that have elapsed since January 1, 1970, 00:00:00 (UTC).

For example, as of writing this, about 1.7 billion seconds have passed since 1970.

2. The 32-bit Limit

The problem is that many older systems and software use a Signed 32-bit Integer to store this value.

The maximum value a 32-bit integer can hold is 2,147,483,647.

Converted to Unix Time, this corresponds exactly to January 19, 2038, 03:14:07 (UTC).

3. When That Day Comes

What happens 1 second after this time?

The number will overflow its maximum value and wrap around to the minimum value, -2,147,483,648.

The system will interpret this time as December 13, 1901.

This could cause:

  • Database date calculations to fail.
  • Scheduling systems to book appointments in the past.
  • Embedded devices or legacy servers to crash.

4. The Solution

The solution is simple but costly: extend the time variable to 64-bit.

The maximum value of a 64-bit integer is about 9 quintillion. This can represent a time span far longer than the age of the universe (about 290 billion years), making it effectively safe forever.

Modern 64-bit operating systems and languages already use 64-bit time. The concern lies with 32-bit embedded devices and legacy code still in operation.

Conclusion

2038 seems far away, but systems dealing with long-term contracts or pensions might already be encountering issues.

As a developer, it's worth checking if the date variables in your code are 32-bit or 64-bit. It's the first step in preventing a future disaster.

TechUnixTimeBug

Explore Related Tools

Try these free developer tools from Pockit