Quirrel4.41.0

datetime.clock

Defined in module "datetime"
from "datetime" import clock
pure fastcall clock(): float

Returns CPU time used by the process in seconds

Return value

Seconds of CPU time as a float, measured from process start.

Notes

This is CPU time, not wall-clock time: it does not advance while the process is idle, for example while blocked on I/O or asleep, so it can read well behind time. Use time to measure how much real time has passed.

Example

examples/datetime/clock.nut
from "datetime" import clock

// the reading itself varies, so only its type and sign are stable
let t = clock()
println("type(t) =", type(t))
println("t >= 0.0 =", t >= 0.0)
Output:
type(t) = float
t >= 0.0 = true

See also

timeReturns the current time as seconds since the Unix epoch
datetimemodule index