Friday, October 06, 2006


The PHP time function is defined as follows:
int time ( void )
Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

This presentation, normally using a 32-bit signed integer, is commonly know as the UNIX time format. This means that the latest time that can be represented in this format, following the POSIX/UNIX time standard, is 03:14:07 UTC on Tuesday, 19 January 2038. Times beyond this moment will "wrap around" and be represented internally as a negative number, and cause programs to fail, since they will see these times not as being in 2038 but rather in 1970 or 1901, depending on the implementation.

This Y2k38 problem, is reminiscent of the Y2K bug, which was also due to memory contraints. In the 1960s, it was the de facto standard to use two characters for every date field since storage were scarce and expensive (those were the days when RAM was measured in bytes). With many industries using computers at the turn of the millenium, there was widespread fear that computers would stop working at exactly midnight, January 1, 2000, leading to a global catastrophy.

Of course, the Y2K bug posted major problems, with many companies rushing to check their source code for the bug. The amount of work generated, however, greatly benefited India, as such work to check and correct source code was outsourced to India. Even Johns Hopkins foreign policy expert Michael Mandelbaum thinks that "Y2K should be called Indian Inter-depedence Day." This millenium bug is reputed to have cost the global economy $US 300 billion. Things could have been very different if early pioneers had more foresight.

Mark Twain once remarked that "20 years from now, you will be disappointed by things that you didn’t do than by the things that you did do." If history is to be any gauge, we can be certain that unless programmers start taking appropriate contingency measures to retify the bug, Y2K38 will post more problems in future.

No comments: