-- LWTimer ---------------------------------------------------------------------------
-- Enables use of real world seconds to time certain behavior. 

LWtimer = {}
LWtimer.__index = LWtimer
function LWtimer:new(limit, startWith) 
	o = {}
	setmetatable(o, LWtimer)
	if startWith then
		o.clock = limit
	else
		o.clock = 0
	end
	o.limit = limit
	return o
end

function LWtimer:tick() 
	local elapsedSec = getGameTime():getRealworldSecondsSinceLastUpdate()
	self.clock = self.clock + elapsedSec 

	if self.limit <= self.clock then
		self.clock = self.clock % self.limit
		return true;
	end 
	return false
end
