tma@progress.COM (Tim Atchison) (02/01/91)
In SVR3, on some machines including the 3b2 and other ATT/SYS5 based machines the library function "napms" doesn't work. The following program proves this problem: -------------- CUT HERE ! ------------------------------------------------------ #include "stdio.h" #include "sys/param.h" main () { long usPerTick = 1000000 / HZ; long usPerCall; long st; long et; int waitTime; long iterations; long totalMicroSeconds; long i; totalMicroSeconds = 30000000; /* 30 sec */ waitTime = usPerTick / 1000; printf ("Testing napms timeout for approx 30 seconds ...\n"); st = time (NULL); iterations = 0; for (i = totalMicroSeconds ; i > 0; i = i - usPerTick) { napms (waitTime); iterations++; } et = time (NULL) - st; usPerCall = (et * 1000000) / iterations; printf ("Elapsed time was %ld seconds for %ld iterations.\n", et, iterations); printf ("Clock ticks every %ld.%03d milliseconds.\n", usPerTick / 1000, usPerTick % 1000); printf ("napms time is %d.%02d milliseconds.\n", usPerCall / 1000, usPerCall % 1000); } -------------- CUT HERE ! ------------------------------------------------------ On machines where this doesn't work (ATT 3b2/600) you get the following output: Testing napms timeout for approx 30 seconds ... Elapsed time was 0 seconds for 3000 iterations. Clock ticks every 10.000 milliseconds. napms time is 0.00 milliseconds. On machines where this works (IBM RS/6000) you get the following output: Testing napms timeout for approx 30 seconds ... Elapsed time was 31 seconds for 3000 iterations. Clock ticks every 10.000 milliseconds. napms time is 10.333 milliseconds. Can anyone get me the source for napms that works ? If not, can any steer me in a direction as to fixes and/or workarounds ? Thanks, and please email me directly. Timothy M. Atchison UUCP: mit-eddie!progress!tma Progress Software Corp. Internet: tma@progress.com 5 Oak Park Bedford, MA 01730 -- Timothy M. Atchison UUCP: mit-eddie!progress!tma Progress Software Corp. Internet: tma@progress.com 5 Oak Park Bedford, MA 01730