Matt Pascoe Matt Pascoe - 1 year ago 113
C++ Question

How do you add a timed delay to a C++ program?

I am trying to add a timed delay in a C++ program, and was wondering if anyone has any suggestions on what I can try or information I can look at?

I wish I had more details on how I am implementing this timed delay, but until I have more information on how to add a timed delay I am not sure on how I should even attempt to implement this.

Answer Source

Win32: Sleep(milliseconds) is what you what

unix: usleep(microseconds) is what you want.

sleep() only takes a number of seconds which is often too long.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download