Monday, March 14, 2011

Y2K38 - Unix Millennium Bug - How To

To Check Y2K38 Problem :
Just execute any one of the following program in your system.

C program:
#include
#include
#include
#include
int main (int argc, char **argv)
{
time_t t;
t = (time_t) 1000000000;
printf ("%d, \t %s", (int) t, asctime (gmtime (&t)));
t = (time_t) (0x7FFFFFFF);
printf ("%d, \t %s", (int) t, asctime (gmtime (&t)));
t++;
printf ("%d, \t %s", (int) t, asctime (gmtime (&t)));
return 0;
}


Output of the above program is here:
1000000000,     Sun Sep 9 01:46:40  2001
2147483647,     Tue Jan 19 03:14:07 2038
-2147483648,    Fri Dec 13 20:45:52 1901  <- Note: Abnormal date.

PHP Program:
<?php
$normal_date = '2038-01-19';
$problem_date = '2038-01-20';
$format = 'l d F Y H:i';
$first_date = strtotime($normal_date);
$second_date = strtotime($problem_date);
echo 'Normal Date :', date($format, $first_date), '<br>';
echo 'Problem Date :', date($format, $second_date), '<br>';
?>

Output of the above program is here:
Normal Date :Tuesday 19 January 2038 00:00
Problem Date :Thursday 01 January 1970 05:30 <- Note: Abnormal date.

Read Other Parts Of This Post :
Y2K38 Unix Millennium Bug : Introduction, How To Check This Bug, Solution

No comments:

Post a Comment

Innovative ways to fight against malware

Keep The Operating System Updated: The first step in protecting your computer from any malicious there is to ensure that your operating sys...