timeHandler.h 374 B

1234567891011121314151617
  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__