Skip to main content

difftime

Function difftime 

Source
pub fn difftime(t2: number, t1: number) -> number
Expand description

Returns the difference between two times.

§Parameters

  • t2: the later time, as returned by time.
  • t1: the earlier time.

§Return value

The difference, in seconds, from time t1 to time t2, as a float. On POSIX, Windows and most other systems this is exactly t2 - t1.

§Examples

local before = os.time()
-- ... some slow work ...
print(os.difftime(os.time(), before))    --> 2.0

§See also

time, clock