Mail Archives: djgpp/2000/05/15/20:21:01
Thank-you for asking for a small test case. In creating it, I found a
key piece of info. It only fails after doing a Control+C in a Windows
98 SE (also Win95) and then restarting the program. The 1st time it
runs great but after killing it and restarting it, then it fails the
very first time. What is Windows doing? Is there a fix?
To compile it:
gcc -o test.exe test.cpp
=================
#include <stdio.h>
#include <time.h>
int delay_clock(unsigned long max_ticks);
int main(int argc, char *argv[]) {
unsigned long int i, j;
for(j=0; j < 0xffffffff; j++) {
for (i=0; i<10000; i++)
delay_clock(60);
printf("done, %08lx\n", j);
} //j
return 0;
} // main
int delay_clock(unsigned long max_ticks) {
unsigned long int
diff_time;
uclock_t
starttime,
endtime;
starttime = uclock();
endtime = starttime;
diff_time = (unsigned long int) (endtime - starttime);
while ( diff_time < max_ticks) {
endtime = uclock();
diff_time = (unsigned long int) (endtime - starttime);
if ((diff_time & 0x80000000) == 0x80000000) {
printf("Error: uclock timer has overflowed.\n");
printf(" starttime=%08lx, endtime=%08lx,
diff_time=%08lx\n",
(unsigned long int) starttime, (unsigned long int)
endtime, diff_time);
exit(1);
} // crazy timer
} /* while delay */
return 0;
} /* delay_clock */
On Sun, 14 May 2000 10:16:31 +0300 (IDT), Eli Zaretskii
<eliz AT is DOT elta DOT co DOT il> wrote:
>
>On Sat, 13 May 2000, Tim Updegrove wrote:
>
>> I'm still having negative values (upper 16 bits out of 32 bits become
>> 0xffff) with uclock() in Windows 98 SE using version 2.03.
>
>Please post a short test program that exhibits this problem, the command
>lines used to compile it and run it, anbd its output on your system.
- Raw text -