Timer.h 864 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2008 Dolphin Emulator Project
  2. // Licensed under GPLv2+
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <string>
  6. #include "Common/CommonTypes.h"
  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. static u64 GetTimeUs();
  29. private:
  30. u64 m_LastTime;
  31. u64 m_StartTime;
  32. bool m_Running;
  33. };
  34. } // Namespace Common