Use the clock function defined in time.h<br><br>void Sleep( clock_t wait )<br>{<br> clock_t goal;<br><br> goal = wait + clock();<br> while( goal > clock() )<br> ;<br>}<br><br> <p> <br><a href=mailto:Kim_Christensen@telus.net>Kim_Christensen@telus.net</a><br><a href=
Not sure if the above can handle anything smaller than seconds, but if you need to wait for a granularity of time less than one second you can use select():<br><br><FONT FACE=monospace>include <sys/time.h><br><br>void main<br>{<br> struct timeval timeout;<br><br> /* set timeout to 0 seconds and 200 milliseconds */<br> timeout.tv_sec = 0;<br> timeout.tv_usec = 200;<br><br> /* waits for 200 milliseconds */<br> select(NULL, NULL, NULL, &timeout);<br>}</font><br><br>Hope that helps!<br>Loon
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.