Difference between revisions of "love.timer.getTime"

m (Clarified the function description.)
Line 1: Line 1:
Returns the amount of time since some time in the past.  
+
Returns the value of a timer with an unspecified starting time.
This function should only be used to calculate differences between points in time, so exactly when this ''some time'' is should not matter.
+
This function should only be used to calculate differences between points in time, as the starting time of the timer is unknown.
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===

Revision as of 22:47, 7 February 2012

Returns the value of a timer with an unspecified starting time. This function should only be used to calculate differences between points in time, as the starting time of the timer is unknown.

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


Other Languages