Posted By

Raisor on 10/05/08


Tagged

simple timer


Versions (?)

Simple C++ Timer


 / Published in: C++
 

Function argument timeinterval is in seconds. For example, SimpleTimer( 5 ) would cause the program to wait for 5 seconds to elapse.

  1. void SimpleTimer( int timeinterval )
  2. {
  3. int starttime, currenttime, difference;
  4.  
  5. starttime = time( null );
  6.  
  7. do
  8. {
  9. currenttime = time( null );
  10. difference = currenttime - starttime;
  11. }
  12. while( difference < timeinterval )
  13. }

Report this snippet  

You need to login to post a comment.