Delay for a fraction of a second in C

Gordon Cross crossgl at ingr.UUCP
Thu Nov 3 00:12:06 AEST 1988


In article <1145 at orion.cf.uci.edu>, echarne at orion.cf.uci.edu (Eli B. Charne) writes:
> 
> The Unix sleep command will only go in increments of one second.  I was
> wondering if someone new of a nice little routine I could use, or has
> written one that will let me pause (in the Unix operating system) for
> a fraction of a second.  If it could go to 100th of a second, that would
> be great!

You are not going to be able to do this without coding up some kind of
"delay loop" yourself.  Of course that solution is definitely NOT portable in
any way since the loop would have to be fine tuned to your machines execution
speed.  Remember that in the UNIX kernal, scheduled wakeups occur at fixed
one second intervals.  Thus, unless you are using a non standard kernal, sleeps
of only whole numbers of seconds are possible!


Gordon Cross
Intergraph Corp.  Huntsville, AL



More information about the Comp.lang.c mailing list