os.difftime()

Type Function
Library os.*
Return value Number
Revision 2017.3083
Keywords difftime, time, date, difference
See also os.time()
os.clock()
os.date()

Overview

Returns the number of seconds from time t1 to time t2. In POSIX, Windows, and some other systems, this value is exactly t2 - t1.

Syntax

os.difftime( t1, t2 )
t1 (required)

Number. First time parameter.

t2 (required)

Number. Second time parameter.

Example

local t1 = os.time()
 
-- Print the elasped time
local function dspTime()
    print( "Time elasped = " .. os.difftime( os.time(), t1 ) )
end

timer.performWithDelay( 2000, dspTime )  -- Wait 2 seconds before calling function