Increment realted to time span

I want to increment a value let say after 5 seconds. When a loop starts it should increment a number after every 5 seconds. Is it possible to do in C++ ?
If there is nothing else to be done in the loop, you can just wait 5 seconds after each increment.
The function for this depends on the OS, it's Sleep(5000) on Windows or sleep(5) on POSIX-compliant systems.
A more portable solution is to use Boost.Thread:
boost::this_thread::sleep(boost::posix_time::seconds(5));
Thanks for reply dear
Topic archived. No new replies allowed.