Wednesday, September 10, 2008

January 19, 2038

At my work, I found some thing really interesting and went on to search what the heck is the deal about 'January 19, 2038'.

I did find some thought provoking information on this.
Current 32-bit Unix Systems can support dates till 'January 19, 2038', because of the max value that can be held in 32-bit integer. After that, date reverts back to the start value, which seems to be 'Dec 13, 1901'.

If you have perl installed on your Unix/Linux Systems, try to run this.
Courtesy : Internet & 2038.org
File :: date.pl
Run :: ./date.pl

====================================
#!/usr/bin/perl

use POSIX;

$ENV{'TZ'} = "GMT";

for ($time = 2147483641; $time < 2147483651; $time++)
{
print ctime($time);
}

====================================


The output of this program looks like this on my machine!

==============================
Tue Jan 19 03:14:01 2038
Tue Jan 19 03:14:02 2038
Tue Jan 19 03:14:03 2038
Tue Jan 19 03:14:04 2038
Tue Jan 19 03:14:05 2038
Tue Jan 19 03:14:06 2038
Tue Jan 19 03:14:07 2038
Fri Dec 13 20:45:52 1901
Fri Dec 13 20:45:52 1901
Fri Dec 13 20:45:52 1901
==============================


Wowwwwwwww!! I hope we find a solution to this soon! Obviously, 64-bit machines would not have this problem. Else, we have to hack some fix in there!