Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Napoleon - stopwatch.cpp

stopwatch.cpp

Caricato da: Crybot
Scarica il programma completo

  1. #include "stopwatch.h"
  2.  
  3.  
  4. StopWatch::StopWatch() { }
  5.  
  6. void StopWatch::Start()
  7. {
  8.     begin = high_resolution_clock::now();
  9. }
  10.  
  11. StopWatch& StopWatch::Stop()
  12. {
  13.     end = high_resolution_clock::now();
  14.     return *this;
  15. }
  16.  
  17. double StopWatch::ElapsedMilliseconds()
  18. {
  19.     return duration_cast<MS>(end - begin).count();
  20. }
  21.  
  22. double StopWatch::ElapsedSeconds()
  23. {
  24.     return duration_cast<MS>(end - begin).count() / (double)1000;
  25.  
  26. }