Os.clock

From GiderosMobile
Revision as of 20:01, 15 December 2023 by MoKaLux (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2011.6
Class: os

Description

Returns CPU time used by the program in seconds.

(number) = os.clock()

Return values

Returns (number) CPU time in seconds

Example

local x = os.clock()
local s = 0
for i = 1, 10000000 do s = s + i end
print(string.format("elapsed time: %.2f\n", os.clock() - x))
-- output: elapsed time: 0.39