Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!hpl-opus!hpccc!hpcc01!azarian From: azarian@hpcc01.HP.COM (Randy Azarian) Newsgroups: comp.lang.c Subject: MSC delay() routine? Message-ID: <1280001@hpcc01.HP.COM> Date: 10 Mar 90 01:14:31 GMT Organization: HP Corporate Computing Center Lines: 27 Does anyone have a delay routine written in C? I don't need something very accurate. If I say delay(3) I want it to pause execution for approximately 3 seconds. (Anything more accurate would be suitable). Here is what I have. It works, but it isn't too consistant. If I say delay(1), sometimes I get a delay for one second, and sometimes I get a microsecond delay. delay(n) int n; { struct dostime_t time1, time2; int i; unsigned long one,two; _dos_gettime(&time1); time2=time1; one = (time1.hour*3600) + (time1.minute*60) + time1.second; two = (time2.hour*3600) + (time2.minute*60) + time2.second; while ((two - one) < n) { _dos_gettime(&time2); two = (time2.hour*3600) + (time2.minute*60) + time2.second; } }