Date: Thu, 26 Dec 1996 17:05:28 +0200 (IST) From: Eli Zaretskii To: Tudor cc: djgpp AT delorie DOT com Subject: Re: DJGPP Date and Time Functions In-Reply-To: <32BF3B63.5C7B@cam.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Mon, 23 Dec 1996, Tudor wrote: > EX: > .... > time start,end; > .... > gettime(&start); > ..... > ..... > gettime(&end); > > at this point start.ti_min equals end.ti_min and the value is totally > screwed up. You didn't post any code (the geek code in the signature doesn't count, I guess), so I can't tell what's wrong with your program. However, the small test program below works well for me: it prints two times which are both reasonable and different from one another. Of course, if I press a key too quickly, the two times are identical, but that's because of the inherent 55ms resolution of the PC clock. Note that the fields of struct time are declared unsigned char. Maybe you used an incorrect format specifier which made the numbers look like if they were garbled? ----------------------------------------------------------------------- #include #include #include int main(void) { struct time start, end; gettime (&start); printf ("Start time is %.2u:%.2u:%.2u.%.2u0\n", start.ti_hour, start.ti_min, start.ti_sec, start.ti_hund); fputs ("Press any key...", stderr); while (!kbhit ()) ; gettime (&end); printf ("\nEnd time is %.2u:%.2u:%.2u.%.2u0\n", end.ti_hour, end.ti_min, end.ti_sec, end.ti_hund); return 0; }