Simple C++ Timer


/ Published in: C++
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.