timer.h 947 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include "common/common_types.h"
  6. #include <string>
  7. namespace Common
  8. {
  9. class Timer
  10. {
  11. public:
  12. Timer();
  13. void Start();
  14. void Stop();
  15. void Update();
  16. // The time difference is always returned in milliseconds, regardless of alternative internal representation
  17. u64 GetTimeDifference();
  18. void AddTimeDifference();
  19. static void IncreaseResolution();
  20. static void RestoreResolution();
  21. static u64 GetTimeSinceJan1970();
  22. static u64 GetLocalTimeSinceJan1970();
  23. static double GetDoubleTime();
  24. static std::string GetTimeFormatted();
  25. std::string GetTimeElapsedFormatted() const;
  26. u64 GetTimeElapsed();
  27. static u32 GetTimeMs();
  28. private:
  29. u64 m_LastTime;
  30. u64 m_StartTime;
  31. bool m_Running;
  32. };
  33. } // Namespace Common