1
0
Fork 0
spectre/source/System/Stopwatch.cpp

25 lines
451 B
C++

#include <Spectre/System/Stopwatch.h>
#include <Spectre/System/System.h>
namespace sp {
Stopwatch::Stopwatch()
{
m_start = Time::milliseconds(system::getMilliseconds());
}
Time Stopwatch::restart()
{
Time now = Time::milliseconds(system::getMilliseconds());
Time elapsed = now - m_start;
m_start = now;
return elapsed;
}
Time Stopwatch::elapsed() const
{
return Time::milliseconds(system::getMilliseconds()) - m_start;
}
} // namespace sp