// DWBS ------------------------------------------------------------------ DWBS
//
// PLATFORM		: ALL
// PRODUCT		: BIT_DEMON
// VISIBILITY	: PUBLIC
//
// DWBS ------------------------------------------------------------------ DWBS

#include <bdCore/bdTiming/bdShortTimer.h>
#include <bdPlatform/bdPlatformMath/bdPlatformMath.h>
#include <bdPlatform/bdPlatformTiming/bdPlatformTiming.h>

bdShortTimer::bdShortTimer()
{
	reset();
}

void bdShortTimer::start()
{
	m_start = static_cast<bdUInt32>(bdPlatformTiming::getHiResTimeStamp() / 100);
}

void bdShortTimer::reset()
{
	m_start = 0;
}

bdFloat32 bdShortTimer::getElapsedTimeInSeconds() const
{
	const bdUInt64 stop = static_cast<bdUInt32>(bdPlatformTiming::getHiResTimeStamp() / 100);
	
	return bdFabsf32(bdPlatformTiming::getElapsedTime(static_cast<bdUInt64>(m_start), stop) * 100);
}
