Skip to content

Time

Time

function set

set(timestamp)
Sets the system time to timestamp seconds since unix epoch.

function time

time()
Returns a float where the integer part is the seconds and the fractional part are microseconds since unix epoch.

function now

now()
Returns an integer with seconds since unix epoch.

function is_sync

is_sync()
Return True if the system time has been synchronized since system (re)start. False otherwise.

function last_sync

last_sync()
Returns the seconds elapsed since last sync.

function time_ns

time_ns()
Returns a float where the integer part is the seconds and the fractional part are nanoseconds since unix epoch.

function millis

millis()
Returns the milliseconds elapsed since system (re)start.

function settime

settime(ti)
Sets the system date and time to ti TimeInfo object.

function localtime

localtime()
Returns a TimeInfo object with current system date and time.

class TimeInfo

TimeInfo()
Class used to store a broken-down time value (as in struct tm) as defined by POSIX.1-2001.

method to_tuple

to_tuple()
Returns a tuple with the broken-down time elements.

method from_tuple

from_tuple(t)
Sets the object time to the t broken-down time tuple.

Broken-down time

A broken-down time is a tuple with the following elements:

  1. year
  2. month
  3. month day
  4. hour
  5. minutes
  6. seconds
  7. week day
  8. year day
  9. whether it is daylight saving time: True, or not: False
  10. whether the Greenwich Mean Time if off: True, or not: False
  11. seconds since epoch
  12. microseconds since epoch