Re: Happy new year 1936 !

From: Amit Aronovitch (amitar1_at_nonexisting.hamakor.org.il)
Date: Sat 08 Jan 2005 - 01:09:50 IST


Dan Aloni wrote:

>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.
>
>
>
Yes, but did you follow the link ( http://www.2038bug.com )?
The specific issue mentioned at the top of the page should celebrate
it's 1st birthday this Monday (1<<30 is 15:37:04, Feb 10, 2004 ).

Try this one:

#include <stdio.h>
#include <time.h>

char date1[] = "Fri, 7 Jan 2005 20:00:01";
char date2[] = "Fri, 7 Jan 2005 20:00:03";

char timefmt[] = "%a, %d %b %Y %H:%M:%S";

int main(int argc, char *argv[]) {
  struct tm time;
  time_t t1,t2,av;
 
  strptime(date1,timefmt,&time);
  t1 = mktime(&time);
  strptime(date2,timefmt,&time);
  t2 = mktime(&time);
 
  printf("First estimate is %s\n",asctime(gmtime(&t1)));
  printf("Second estimate is %s\n",asctime(gmtime(&t2)));
 
  av = (t1+t2)/2; /* BUG: Should be something like (0.5+t1+t2)/2 */
 
  printf("So, I guess average estimate is %s\n",asctime(gmtime(&av)));
}

  ... British Mandate's back in town ... ;-)

 I don't recall any such trouble last year, but who knows - it might had
actually been fixed before I noticed, and it might still exist in some
programs I don't use...

=================================================================
To unsubscribe, send mail to linux-il-request_at_linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request_at_linux.org.il



This archive was generated by hypermail 2.1.7 : Sat 08 Jan 2005 - 01:25:48 IST