dolphin/Source/Core/Common/Timer.h
Shawn Hoffman 3384b1385e move "double time" code into State from Timer
Ideally the statesave format could be changed
to just store a u64 in the future
2022-08-02 22:24:06 -07:00

36 lines
667 B
C++

// Copyright 2008 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "Common/CommonTypes.h"
namespace Common
{
class Timer
{
public:
static u64 NowUs();
static u64 NowMs();
void Start();
// Start(), then decrement start time by the offset.
// Effectively "resumes" a timer
void StartWithOffset(u64 offset);
void Stop();
bool IsRunning() const { return m_running; }
u64 ElapsedMs() const;
static u64 GetLocalTimeSinceJan1970();
static void IncreaseResolution();
static void RestoreResolution();
private:
u64 m_start_ms{0};
u64 m_end_ms{0};
bool m_running{false};
};
} // Namespace Common