Path: utzoo!attcan!uunet!zephyr.ens.tek.com!uw-beaver!mit-eddie!wuarchive!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpcc01!hpcuhb!morrell From: morrell@hpcuhb.HP.COM (Michael Morrell) Newsgroups: comp.unix.internals Subject: Re: Can Unix sleep in terms of mili/micro? Message-ID: <37960001@hpcuhb.HP.COM> Date: 12 Sep 90 21:56:23 GMT References: <24437@adm.BRL.MIL> Organization: Hewlett Packard, Cupertino Lines: 22 /comp.unix.internals/james@dlss2.UUCP (James Cummings)/5:11 am Sep 11, 1990/ >> Can Unix sleep in terms of mili or mirco second? > sleep_less_than_sec(x) > int x; > { > int i; > > for (i = 0;i <= x;i++) > ; > } > I'd think that would give you approx. 25 clock cycles, dependent on >the machine, the load on the machine, etc. ---------- This is not a very good idea. Any decent optimizer will simply optimize away your code loop and you won't get any delay (although if you declare "i" as volatile, it shouldn't be removed, but it's still very dependent on the machine and its current load). Michael