AuroraRuntime/Include/Aurora/Time/Stopwatch.hpp
Reece 82d455c4b1 [+] AuTime::EClock
[+] AuTime::IClock
[+] AuTime::GetWallClock
[+] AuTime::GetProcessClock
[+] AuTime::GetSteadyClock
[+] AuTime::GetClockFromEnum
[*] Rename Timer -> Stopwatch
[*] Refactor a serial AuString to a string view

(*amended year)
2023-03-21 10:26:16 +00:00

53 lines
993 B
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: Stopwatch.hpp
Date: 2021-6-10
Author: Reece
***/
#pragma once
namespace Aurora::Time
{
AUKN_SYM AuUInt64 SteadyClockNS();
struct Stopwatch
{
inline Stopwatch()
{
Start();
}
inline ~Stopwatch()
{
}
inline void Start()
{
this->start_ = SteadyClockNS();
}
inline void Reset()
{
this->start_ = SteadyClockNS();
this->end_ = 0;
}
inline AuUInt64 EndNS()
{
if (!this->end_) this->end_ = SteadyClockNS();
return this->end_ - this->start_;
}
inline AuUInt64 EndMS()
{
if (!this->end_) this->end_ = SteadyClockNS();
return AuNSToMS<AuUInt64>(this->end_ - this->start_);
}
private:
AuUInt64 start_;
AuUInt64 end_;
};
}