Date: Sun, 15 Dec 1996 22:44:19 -0500 (EST) From: Michael Phelps To: djgpp AT delorie DOT com Subject: delay() problem Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Someone posted a problem with delay() starting to delay more after around 30 seconds and locking up. Could you provide a little more information about your machine and operating system and such? I am unable to reproduce the problem on my 5x86 under Win 95 with the following program: #include #include #include #define RESOLUTION 100 int main() { uclock_t last_time, current_time; int x = 0; last_time = uclock(); /* start timing */ while (1) { delay(1); /* delay 1 msec */ x++; if (x % RESOLUTION == 0) { current_time = uclock(); printf("%d 1 msec delays, actual time: %f\n", RESOLUTION, (double)(current_time - last_time) / UCLOCKS_PER_SEC); last_time = current_time; } } return 0; } I get an average of around 120 msec for each 100 1 msec delay interations, regardless of how long I let the program run. (The range is from 110 msec to 170 msec, and remember, this is under a multitasking environment.) ---Michael Phelps morphine AT cs DOT jhu DOT edu CH3 | N / | ______/ | / \ CH2 _____/ \__|__ // \\ / | \\ // \\______/___CH2 \\ \ / \ / \______/ \_____/ / ------ \ / \ OH \ / OH O Morphine