timeHandler.h 374 B

12345678910111213141516
  1. #ifndef TIMEHANDLER_H
  2. #define TIMEHANDLER_H
  3. #include <ctime>
  4. class timeHandler
  5. {
  6. public:
  7. clock_t start, last, mem;
  8. timeHandler():start(clock()){last=clock();mem=0;};
  9. long getDif(){long ret=clock()-last;last=clock();return ret;};
  10. void update(){last=clock();};
  11. void remember(){mem=clock();};
  12. long memDif(){return mem-clock();};
  13. };
  14. #endif //TIMEHANDLER_H