|
Timer |
xinco1
Member #8,061
December 2006
|
Whats the best way of telling when 10 seconds has gone by,for example? |
kazzmir
Member #1,786
December 2001
|
rest( 10 * 1000 ); Do you want to do something while 10 seconds is going by or just wait for 10 seconds? If the former you can set up a timer with increment a variable every tick and then when the variable * ticks reaches 10 seconds you know 10 seconds will have past. |
Billybob
Member #3,136
January 2003
|
ImLeftFooted
Member #3,935
October 2003
|
Timer::time_t t = timer.secs(); ... if(timer.secs() - t > 9) .. 10 seconds have elapsed .. Even easier: stopwatch sw; sw.start(10000); .. if(sw.check()) .. 10 seconds have elapsed .. If you want either of these classes I can give them to you. |
Goalie Ca
Member #2,579
July 2002
|
http://www.boost.org/libs/timer/timer.htm It's cross platform. I can't recall if this particular boost lib will be in the next C++ standard but its probably a good shot. It's resolution depends on OS's but windows and *nix are both millisecond tickers IIRC. from the site:
------------- |
|