Time Functions
The time namespace include three useful time functions:
time.tic()
-- set the wall-clock timer
m = time.toc()
-- return the number of milliseconds elapsed since the last time.tic()
call
time.sleep(m)
-- sleep for m milliseconds
time.format(m)
-- format a duration m (in milliseconds) into string
Example:
Copy the following script in the editor and click Run (or press F12 on Windows
and Linux)
-- Timer
cls()
tic()
sleep(1000)
dt = toc()
print(time.format(dt))
|