
#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
