#ifndef _COMMON_TIMER_HPP_
#define _COMMON_TIMER_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif

class Timer
{
public:
	Timer(void);
	virtual ~Timer(void);
	void	startTimer(LONG milliSeconds);
	WORD	hasExpired(void);
private:
	long	mStartTime;
	long	mStopTime;
	WORD	mHasExpired;
};

inline
Timer::Timer()
: mHasExpired(FALSE)
{
}

inline
Timer::~Timer()
{
}

inline
void Timer::startTimer(LONG milliSeconds)
{
	mStartTime=::GetTickCount();
	mStopTime=mStartTime+milliSeconds;
}

inline
WORD Timer::hasExpired(void)
{
	if (mStopTime<mStartTime)
		return TRUE;
	mStartTime+=::GetTickCount()-mStartTime;
	return FALSE;
}
#endif
