timer.h 954 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 <string>
  6. #include "common/common_types.h"
  7. namespace Common {
  8. class Timer {
  9. public:
  10. Timer();
  11. void Start();
  12. void Stop();
  13. void Update();
  14. // The time difference is always returned in milliseconds, regardless of alternative internal
  15. // representation
  16. u64 GetTimeDifference();
  17. void AddTimeDifference();
  18. static void IncreaseResolution();
  19. static void RestoreResolution();
  20. static u64 GetTimeSinceJan1970();
  21. static u64 GetLocalTimeSinceJan1970();
  22. static double GetDoubleTime();
  23. static std::string GetTimeFormatted();
  24. std::string GetTimeElapsedFormatted() const;
  25. u64 GetTimeElapsed();
  26. static u32 GetTimeMs();
  27. private:
  28. u64 m_LastTime;
  29. u64 m_StartTime;
  30. bool m_Running;
  31. };
  32. } // Namespace Common