Usleep

From LQWiki
Jump to navigation Jump to search

usleep suspends execution for microsecond intervals.

wait for 1 microsecond:

$ usleep 1

wait for 1000 microseconds, which is 1 milli second:

$ usleep 1000

wait for 1 million microseconds, which is 1 second:

$ usleep 1000000


sleep 1 is equivalent to usleep 1000000

BUGS : Probably not accurate on many machines down to the microsecond. Count on precision only to -4 or maybe -5.

If you have a fast PC like a 2 GHz P4 or AMD, the accuracy is ok.

See also