Computing error related to time issue will be expected on 2038.This is because of improper functioning of program standard time library in c language, where the time calculation was based on four byte format.And it is expected that it will show time in negative format.Computer professionals and technologist call this error as "Unix millennium bug" or Y2K38 / Y2.038K.
You can test and understand how this error will by the following C program codings,
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <time.h>
int main (int argc,char **argv)
{
time_t t;
t=(time_t) 1000000000;
printf("%d,%s",(int) t,asctime (gmtime (&t)));
t=(time_t) (0X7FFFFFFF);
printf("%d,%s",(int) t,asctime (gmtime (&t)));
t++;
printf("%d,%s",(int) T,asctime (gmtime (&t)));
return 0;
}
Output for this program will be:
1000000000,Sun Sep 9 01:46:40 2001
2147483647,Tue Jan 19 03:14:07 2038
-2147483648,Fri Dec 13 20:45:52 1901
You can test and understand how this error will by the following C program codings,
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <time.h>
int main (int argc,char **argv)
{
time_t t;
t=(time_t) 1000000000;
printf("%d,%s",(int) t,asctime (gmtime (&t)));
t=(time_t) (0X7FFFFFFF);
printf("%d,%s",(int) t,asctime (gmtime (&t)));
t++;
printf("%d,%s",(int) T,asctime (gmtime (&t)));
return 0;
}
Output for this program will be:
1000000000,Sun Sep 9 01:46:40 2001
2147483647,Tue Jan 19 03:14:07 2038
-2147483648,Fri Dec 13 20:45:52 1901
No comments :
Post a Comment