Home > PHP/MySQL Programming > The doom of 2038

The doom of 2038

September 17th, 2006

Pack the food tins, batteries, clothing, and maybe build a little bunker as the millennium bug is back! (Except we’ve got until 2038 and it will be far easier to fix).

Back in 2000 the world was in turmoil as the Y2K bug reared its ugly head. The world’s computer systems were set to explode, money would miraculously disappear, food and oil supplies would dry up over night, and nuclear warheads would fire off sporadically.

Following a recent issue with a modified date of a file, it became apparent to me that there will inevitably be a major problem in 2038. Some dates are stored in various computer systems using a Unix timestamp. A Unix timestamp is a 32-bit (10 digit) number which is used to store a date. See example below.

1110285045 = Tue 8 March 2005, 1:30:45 pm

The timestamp is the number of seconds since Thu 1 January 1970, 0:00:00 am (the birth date of Unix). To store dates before 1970 a negative value is used. What’s the problem then? I hear you ask…

The maximum number a timestamp can be is 9999999999. This translates as Tue 19 January 2038, 4:14:07 am. After this date all dates will have to be stored using a 64-bit number.

What does this mean?

Without going into too much technical jargon, current systems store the date in the 32-bit format. The databases will need to be adjusted to handle a 64-bit timestamp instead. In summary, it’s a quick and easy fix as very little (if none at all) changes will be required to the applications themselves.

When will this have an affect?

This depends on the systems and how far they look ahead. Websites typically look ahead 5-10 years when giving visitors the option to select a date, however, banks and financial organisations can look ahead 30 years. In 2008, a 30 year mortgage application will fall into the danger zone.

What systems will be affected?

Only systems using the Unix timestamp to store dates will be affected. These are the exact opposite systems that would have been affected back in 2000 with the millennium bug.

In summary, the run up to 2038 will prove a difficult time for computer systems, although the problem is easily remedied.

Further information

To read more information on Unix or for more articles on the 2038 bug visit the following useful links.

Bookmark and Share

PHP/MySQL Programming

  1. Archive
    March 25th, 2009 at 17:41 | #1

    Interesting to note that once the timestamp is stored as a 64-bit number this will last for 290 billion years - just enough I think!

  1. No trackbacks yet.