Apr 28, 2009 at 3:12pm UTC
Hi,
I am using ubuntu linux.
How to make a time delay of a more than 30min using C++.
Last edited on Apr 28, 2009 at 3:52pm UTC
Apr 28, 2009 at 5:29pm UTC
...What?
"How to make a time delay of a more than 30min using C++."
It sounds like you want a timer but I'm not exactly sure. :/
Last edited on Apr 28, 2009 at 5:30pm UTC
Apr 28, 2009 at 6:32pm UTC
you can use sleep().
it take time in milliseconds.. so calculate how much you need to pass..
it will be around.. (1000 * 60 * 30)
Apr 28, 2009 at 7:53pm UTC
I thought sleep only worked in Windows?
Apr 28, 2009 at 8:01pm UTC
Sleep is the Windows version, the parameter is milli-seconds.
sleep is the Unix version, the parameter is seconds.
May 15, 2009 at 8:04am UTC
Sorry for late reply
#include <ctime>
inline void mySleep(clock_t sec) // clock_t is a like typedef unsigned int clock_t. Use clock_t instead of integer in this context
{
clock_t start_time = clock();
clock_t end_time = sec * 1000 + start_time
while(clock() != end_time);
}
Last edited on May 15, 2009 at 8:15am UTC