Difference between revisions of "love.timer.getTime"

(Added example.)
Line 14: Line 14:
 
<source lang="lua">
 
<source lang="lua">
 
foo = ""
 
foo = ""
stime = love.time.getTime()
+
stime = love.timer.getTime()
  
 
for i=1,1000 do
 
for i=1,1000 do
Line 20: Line 20:
 
end
 
end
  
etime = love.time.getTime()
+
etime = love.timer.getTime()
 
print("It took " .. (etime-stime) .. " to concatenate 'bar' 1000 times!")
 
print("It took " .. (etime-stime) .. " to concatenate 'bar' 1000 times!")
 
</source>
 
</source>

Revision as of 02:54, 5 August 2010

Returns the amount of time since some time in the past. This function should only be used to calculate differences between points in time, so exactly when this some time is should not matter.

Function

Synopsis

time = love.timer.getTime( )

Arguments

None.

Returns

number time
The time in seconds.

Examples

Checking how long something takes

foo = ""
stime = love.timer.getTime()

for i=1,1000 do
	foo = foo .. "bar"
end

etime = love.timer.getTime()
print("It took " .. (etime-stime) .. " to concatenate 'bar' 1000 times!")

See Also