2013-04-18 06:09:55 +03:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 06:46:09 +02:00
|
|
|
|
2014-02-10 20:54:46 +02:00
|
|
|
#pragma once
|
2008-12-08 06:46:09 +02:00
|
|
|
|
2009-01-15 13:46:09 +02:00
|
|
|
#include <string>
|
2014-02-17 12:18:15 +02:00
|
|
|
#include "Common/CommonTypes.h"
|
2010-01-21 21:55:01 +02:00
|
|
|
|
2008-12-08 06:46:09 +02:00
|
|
|
namespace Common
|
|
|
|
{
|
|
|
|
class Timer
|
|
|
|
{
|
2009-02-22 14:43:25 +02:00
|
|
|
public:
|
|
|
|
Timer();
|
|
|
|
|
|
|
|
void Start();
|
|
|
|
void Stop();
|
|
|
|
void Update();
|
|
|
|
|
|
|
|
// The time difference is always returned in milliseconds, regardless of alternative internal representation
|
2010-01-07 22:01:41 +02:00
|
|
|
u64 GetTimeDifference();
|
2009-02-22 14:43:25 +02:00
|
|
|
void AddTimeDifference();
|
|
|
|
|
|
|
|
static void IncreaseResolution();
|
|
|
|
static void RestoreResolution();
|
|
|
|
static u64 GetTimeSinceJan1970();
|
|
|
|
static u64 GetLocalTimeSinceJan1970();
|
2009-08-25 09:34:58 +03:00
|
|
|
static double GetDoubleTime();
|
2009-02-22 14:43:25 +02:00
|
|
|
|
|
|
|
static std::string GetTimeFormatted();
|
|
|
|
std::string GetTimeElapsedFormatted() const;
|
|
|
|
u64 GetTimeElapsed();
|
|
|
|
|
2010-01-21 21:55:01 +02:00
|
|
|
static u32 GetTimeMs();
|
|
|
|
|
|
|
|
private:
|
2009-02-22 14:43:25 +02:00
|
|
|
u64 m_LastTime;
|
|
|
|
u64 m_StartTime;
|
|
|
|
bool m_Running;
|
2008-12-08 06:46:09 +02:00
|
|
|
};
|
2009-02-22 14:43:25 +02:00
|
|
|
|
2009-03-28 10:57:34 +02:00
|
|
|
} // Namespace Common
|