mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 10:56:58 +02:00
Initial commit
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#ifndef KYTY_COMMON_TIMER_H_
|
||||
#define KYTY_COMMON_TIMER_H_
|
||||
|
||||
#include "common/common.h"
|
||||
|
||||
namespace Common {
|
||||
|
||||
class Timer final {
|
||||
public:
|
||||
Timer() noexcept;
|
||||
~Timer() = default;
|
||||
|
||||
void Start();
|
||||
|
||||
void Pause();
|
||||
|
||||
void Resume();
|
||||
|
||||
[[nodiscard]] bool IsPaused() const;
|
||||
|
||||
// return time in milliseconds
|
||||
[[nodiscard]] double GetTimeMs() const;
|
||||
|
||||
// return time in seconds
|
||||
[[nodiscard]] double GetTimeS() const;
|
||||
|
||||
// return time in ticks
|
||||
[[nodiscard]] uint64_t GetTicks() const;
|
||||
|
||||
// return ticks frequency
|
||||
[[nodiscard]] uint64_t GetFrequency() const;
|
||||
|
||||
KYTY_CLASS_NO_COPY(Timer);
|
||||
|
||||
[[nodiscard]] static uint64_t QueryPerformanceFrequency();
|
||||
[[nodiscard]] static uint64_t QueryPerformanceCounter();
|
||||
|
||||
private:
|
||||
bool m_is_paused = true;
|
||||
uint64_t m_Frequency = 0;
|
||||
uint64_t m_StartTime = 0;
|
||||
uint64_t m_PauseTime = 0;
|
||||
};
|
||||
|
||||
} // namespace Common
|
||||
|
||||
#endif /* KYTY_COMMON_TIMER_H_ */
|
||||
Reference in New Issue
Block a user