Programming Environment for Numerical Computing

Time Functions

The time namespace include three useful time functions:

time.tic()

-- set the wall-clock timer

dtime = time.toc()

-- return the number of milliseconds elapsed since the last time.tic() call

time.sleep(n)

-- sleep for n milliseconds

time.format(t)

-- format a duration (integer 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))

 

 Copyright(C) 2010-2017 Dr. Sidi HAMADY