Timer.h 693 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * TI Voxel Lib component.
  3. *
  4. * Copyright (c) 2014 Texas Instruments Inc.
  5. */
  6. #ifndef VOXEL_TIME_H
  7. #define VOXEL_TIME_H
  8. #include "Common.h"
  9. namespace Voxel
  10. {
  11. /**
  12. * \addtogroup Util
  13. * @{
  14. */
  15. class VOXEL_EXPORT Timer
  16. {
  17. TimeStampType _realTimeStart = 0, _monoticStart = 0;
  18. bool _initialized = false;
  19. public:
  20. Timer()
  21. {
  22. init();
  23. }
  24. inline bool isInitialized() { return _initialized; }
  25. bool init();
  26. // Assumption: MONOTIC clock's epoch began recently while REALTIME's epoch began a long time ago (~44 years ago)
  27. TimeStampType convertToRealTime(TimeStampType l);
  28. TimeStampType getCurrentRealTime();
  29. };
  30. /**
  31. * @}
  32. */
  33. }
  34. #endif // VOXEL_TIME_H