|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mathueie (22) | |
|
Hi, I am using ubuntu linux. How to make a time delay of a more than 30min using C++. | |
|
Last edited on
|
|
| computerquip (1682) | |
|
...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
|
|
| writetonsharma (1181) | |
|
you can use sleep(). it take time in milliseconds.. so calculate how much you need to pass.. it will be around.. (1000 * 60 * 30) | |
|
|
|
| computerquip (1682) | |
| I thought sleep only worked in Windows? | |
|
|
|
| kbw (3825) | |
|
Sleep is the Windows version, the parameter is milli-seconds. sleep is the Unix version, the parameter is seconds. | |
|
|
|
| Duoas (5977) | |||
usleep() is the *nix equivalent, the argument is in micro-seconds (10-6).
http://www.google.com/search?btnI=1&q=msdn+sleep http://linux.die.net/man/3/usleep Just to be complete. ;-) | |||
|
|
|||
| mathueie (22) | |
|
Hi Thanks friends...... | |
|
|
|
| Denis (346) | |
|
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
|
|