playTimer=Timer.new(0)
playTimer:reset()

function startTimer()
	playTimer:start()
end

function stopTimer()
	playTimer:reset()
end

--returns nil if no event, otherwise returns something (for the moment, the time past since the last event)
function getPlayEvent(fast, endGame)
	local timerTime=playTimer:time()
	--local d="false"
	--if endGame then
	--	d="true"
	--end
	--fdebug("EVENT: endgame="..d..", endGameSpeed="..USERPREF["endGameSpeed"])
	if 	(endGame and USERPREF["quickFinish"] and timerTime>=USERPREF["endGameSpeed"]) or
		(fast and timerTime>=USERPREF["fastSpeed"]) or 
		(fast==false and timerTime>=USERPREF["slowSpeed"])  then
		playTimer:reset()
		playTimer:start()
		return timerTime
	end
	return nil
end