Quirrel4.41.0

datetime.time

Defined in module "datetime"
from "datetime" import time
fastcall time(): int

Returns the current time as seconds since the Unix epoch

Return value

Seconds since the Unix epoch (1970-01-01 00:00:00 UTC), as an int.

Notes

This reads the system clock, so it follows any change to it: a clock set backward by the user or by NTP can make one reading lower than an earlier one. date converts a value like this one into calendar fields, and uses this function itself for its own current-time default.

Example

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

// the wall clock never runs backwards between two calls in the same script
let t1 = time()
let t2 = time()
println("type(t1) =", type(t1))
println("t2 >= t1 =", t2 >= t1)
Output:
type(t1) = integer
t2 >= t1 = true

See also

clockReturns CPU time used by the process in seconds
dateReturns a table with date fields (sec,min,hour,day,month,year,wday,yday); format 'l' for local, 'u' for UTC
datetimemodule index