Now coming back to the fact which i thought i was the first one to find out,but it wasnt that infact was a figment of ma imagination(this metaphar is ma recent creation),finding on the innernet i could easily locate 8-10 sites stating the same thing i was and thattoo in decibels much louder than mine and with speakers that had true value bass and rock genre.
Consider the code:-
#include
#include
int main()
{
clrscr();
struct tm *gmt;//object of the structure tm with acts as actual parameter to asctime()
time_t t;
t=(time_t)0x7FFFFFFF;//the POSIX time_t object
gmt = gmtime(&t);
printf("GMT is: %s", asctime(gmt));
t++;
gmt = gmtime(&t);
printf("GMT is: %s", asctime(gmt));
return 1;
}
OUTPUT:-
GMT is Tue Jan 19 03:14:07 2038
GMT is Fri Dec 13 20:45:52 1901 !!!!!The name freaky friday co-realates here)!!!!!
Now the output should have time somewhere pondering around in the year 2038 but its not so.The reason behind is that POSIX or for that matter any other time service uses co-ordinated universal time(UTC) and this counts the number of milliseconds since jan 1 1970, and we predominantly use a 32 bit computing system so the maximumvalue that time_t object can take is 2^32,that counts to be 4294967296.Exceeding thislimit the object tends to take the most negative value possible and that ofcourse is -4294967297.Now this corresponds to jan 1 1901.So we might be getting a problem in the year 2038 wherein all the 32 bit based software or programs will be set to the year 1901.
The solutions that are in place are implementing the ifs and buts control statement to reengineer the code of legacy systems but by far the most optimal solution had to be to change the storage paradigm of time_t to 64 bit.
3 comments:
Interesting to note this, tu holidys mey bhi yehi kam kara raha hai,Tu kaha badalne wala hai. Anyways visit my blogdabster39.blogspot.com and dun forget to read lalu post thr.
See Ya !
i remember u told me abt this once. good that u have come up on a blog on this. keep going!!
Thanks timir..but Alas twas too late..lol
Post a Comment