From: venkman1 AT ix DOT netcom DOT com (Narayan Natarajan) Subject: Re: Date problem... : Bug report 15 Jan 1998 03:48:38 -0800 Message-ID: <3.0.1.32.19980113195939.0095d120.cygnus.gnu-win32@popd.ix.netcom.com> References: <3 DOT 0 DOT 1 DOT 32 DOT 19980109231907 DOT 00952340 AT popd DOT ix DOT netcom DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: gnu-win32 AT cygnus DOT com Hi all, This is in response to my own posting about date. I installed mingw32 and compiled the same program below. And lo and behold, the times were reported correctly. I guess this means that there is a bug in the time functions. I don't think I found this in you mailing list archives. As always - thank you for your responses. Narayan >Hi, > >I am having problems with dates. I am writing a program to create >importable files for a certain scheduler and for some reason some of the >events appear 1 hour earlier than when set. The following hex numbers are >in time_t format right from the datafile of the scheduler, they are to be >read in reverse (HOB, LOB order of things): > >f0884334 >70da4434 >f02b4634 >707d4734 > >They correspond to 8:00 AM entries for dates between october 14th - 17th >(it does the same thing during April 1-4). The following code takes these >hex numbers as command line input and outputs the date (took precaution to >invert it just in case I input HOB-LOB in the wrong order). > >/************************/ >#include >#include > > >main(argc, argv) >char **argv; >int argc; >{ > time_t time_arg; > char *strptr; > char invert[BUFSIZ]; > int i,j=0,k; > if ( argc < 2 ) exit(1); > > for ( k=1; k < argc ; k++ ) > { > time_arg = (time_t) strtoul( argv[k], &strptr, 16 ); > printf("ctime %s %s\n",argv[k], ctime( &time_arg )); > for ( i = strlen( argv[k] )-1 ; i >= 0 ; i-= 2 ) > { > invert[j] = argv[k][i-1]; > invert[j+1] = argv[k][i]; > j+=2; > } > invert[j] = '\0'; > time_arg = (time_t) strtoul( invert, &strptr, 16 ); > > printf("ctime %s %s\n", invert, ctime( &time_arg )); > j=0; > } >} > >/*******************/ > From the above code I get all these events to be at 7:00 AM instead of >8:00 AM. >Could someone tell me if I am doing something wrong or if I should blame >the scheduling software. | Narayan _/~~~~~~~~~~~~~~~~~~~~~ venkman1 AT ix DOT netcom DOT com ~~~~~~~~~~~~/ |Natarajan _/ . .____ _ _/ | _/ "I am not a vegetarian * . x -(____/ | _ / | _/ because I love animals; ________/____/ \ ( )----- | _/ I am a vegetarian because I ,/ _ ( ------- | _/ hate plants." <________\ // (_)----- | _/ --<== * |_____/ _ |/ http://www.netcom.com/~venkman1 -(_____) (_)----- |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".