Delay for a fraction of a second in C

George Kaplan gckaplan at soup.ssl.berkeley.edu
Fri Nov 4 03:02:47 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!

On a Sun (and presumably under bsd 4.x as well) there's a usleep()
function to sleep for a specified number of microseconds:

	void usleep(useconds)
	unsigned useconds;

This actually pauses for _at least_ the specified number of useconds.
The actual delay may be longer depending on other activity in the
system.

- George C. Kaplan		gkaplan at sag4.ssl.berkeley.edu



More information about the Comp.lang.c mailing list