mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
37 lines
731 B
C++
37 lines
731 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;
|
|
|
|
// The rest of these functions probably belong somewhere else
|
|
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
|