Files
Exponential/Exponential/Timer.h
Jonathan Rampersad 5e568c95fb Add project files.
2023-09-05 09:54:19 -04:00

42 lines
642 B
C++

#pragma once
#include <ostream>
#include <chrono>
namespace TIMER{
struct Timer
{
std::chrono::time_point<std::chrono::steady_clock> start, end;
std::chrono::duration<float> duration;
Timer()
{
Reset();
}
~Timer()
{
}
inline void Reset() noexcept
{
start = std::chrono::high_resolution_clock::now();
}
void SetEnd() noexcept
{
end = std::chrono::high_resolution_clock::now();
duration = end - start;
}
inline float GetTimeInMS() const noexcept
{
return float(duration.count() * 1000.f);
}
inline float GetTimeInS() const noexcept
{
return float(duration.count());
}
};
}