os.clock()

Type Function
Library os.*
Return value Number
Revision 2017.3082
Keywords os, clock, time, date
See also system.getTimer()
os.time()
os.date()

Overview

Returns an approximation of the amount in seconds of CPU time used by the program.

This is a standard Lua function that returns the CPU in seconds. A run time of 5 seconds returns as 0.05. It counts from 0.00 to 0.99 before rolling over to 1.00.

Syntax

os.clock()

Example

Display CPU Time

print( os.clock() )  -- Outputs CPU time to terminal