Nadav Har'El wrote:
On Thu, Jan 06, 2005, Dan Aloni wrote about "Re: Happy new year 2038 !":

   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)));

Oh, the "2^31 seconds are enough time for everybody", brought to you by one or more careless UNIX designers who might be lucky enough to be alive and 100+ years old when this bug actually manifests.


Like everyone said, this problem will be a non-problem in *source code*
as time_t will become 64 bit long before 2038. But there could be a problem
for people which have only binaries and/or save data in a binary format,
and expect to use the same code and data long into the future. An example
of such binary format is a file system.

Anyway, the problem here is much less severe than the infamous "Y2K" bug.
The problem with the Y2K bug was ambiguity - is "00" an error, 1900 or 2000?
In the Unix-like counters, there is no ambiguity. The number 2348248 means
exactly one thing, and will continue to do so forever, even if you allow
new numbers to be larger. If you take 2^31-1 and increase it by one and your
(signed) number becomes -2^31, there is still no ambiguity. It doesn't look
like an error (time(2)'s error is -1) or like any other possible date.

BTW, I don't understand why you put the problem at 2^31 seconds. What's
wrong with the last bit??? If you allow 32 bits, you have until 2106 to
relax :) Of course, you'll have a little problem with times "looking" like
they're negative, but who cares, really? If you want to compare times
you can cast them to unsigned long beforehand. Just a little trick to buy
us 68 more years...

35 years ahead is very common in the insurance business.
It's not the end of the world :) but still a problem which will be much easier to solve in our free environment than in anywhere else.


Moish

P.S. "negative" date is always the same date (at least with MDK10.1 libraries ):
1000000000, Sun Sep 9 01:46:40 2001
2147483647, Tue Jan 19 03:14:07 2038
-2147483648, Fri Dec 13 20:45:52 1901
-2147483647, Fri Dec 13 20:45:53 1901


Note !  Fri 13th ! I smell conspiracy !


================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]



Reply via email to