#include "TimerPC.h"
#include <iostream>

Timer::Timer()
{
	//std::cout << "Initializing Timer - CLOCKS_PER_SEC = " << CLOCKS_PER_SEC << std::endl << std::endl;
	Reset();
}

void Timer::Reset()
{
	startTime = clock();
	lastTime = startTime;
}

float Timer::GetElapsedSeconds()
{
	clock_t currentTime = clock();
	float elapsedMilliseconds = (float)((float)(currentTime-lastTime)/((float)CLOCKS_PER_SEC/1000.0));
	lastTime = currentTime;
	
	//if (elapsedMilliseconds <= 0)
	//{
	//	elapsedMilliseconds = 1;
	//}

	return elapsedMilliseconds/1000;
}
