Skip to main content

clock

Function clock 

Source
pub fn clock() -> number
Expand description

Returns the CPU time used by the program.

§Return value

An approximation of the amount in seconds of CPU time used by the program, as returned by the underlying ISO C function clock. Useful for benchmarking.

§Examples

local t0 = os.clock()
for i = 1, 1e7 do end
print(os.clock() - t0)    --> 0.031  (elapsed CPU seconds)

§See also

time, difftime