love.timer.getTime( )
Note that this function does not get the current time! It is meant for
timing pieces of code.
Also, this function is not very precise at the moment, since SDL's timer is used. This will change in some time in the future when modules for timers with higher resolutions are created.
Also, this function is not very precise at the moment, since SDL's timer is used. This will change in some time in the future when modules for timers with higher resolutions are created.
Usage
love.timer.getTime( )
Arguments
None
Returns
numberThe (approximate) time in seconds since startup.
Examples
Example 1: Timing code.
-- Assuming we have a huge (10000) array of sprites:
function draw()
local t = love.graphics.getTime()
for i=1,10000 do
love.graphics.draw(sprites[i], sprites[i].x, sprites[i].y)
end
local elapsed = love.graphics.getTime() - t
print("Time used to draw: " .. elapsed .. " seconds.")
end