Type Function Library os.* Return value Number Revision Release 2025.3721 Keywords difftime, time, date, difference See also os.time() os.clock() os.date()
Returns the number of seconds from time t1 to time t2. In POSIX, Windows, and some other systems, this value is exactly t2 - t1
os.difftime( newerTime, olderTime )
Number. First time parameter.
Number. Second time parameter.
local olderTime = os.time()
-- Print the elasped time
local function dspTime()
print( "Time elasped = " .. os.difftime( os.time(), olderTime ) )
end
timer.performWithDelay( 2000, dspTime ) -- Wait 2 seconds before calling function