Skip to main content

time

Standard library Module View source
function time
time() -> float
function time_ns
time_ns() -> int
function monotonic
monotonic() -> float
function monotonic_ns
monotonic_ns() -> int
function perf_counter
perf_counter() -> float
function perf_counter_ns
perf_counter_ns() -> int
function sleep
sleep(secs: float, /)
class TimeInterval
class TimeInterval

Utility class for timing Codon code

Fields 2
start int
msg str
Constructors 1
__init__
__init__(self: Self)
Methods 3
report
report(self: Self, msg = "", memory = False) -> str
elapsed
elapsed(self: Self) -> float
tick
tick(self: Self, msg, memory = False)
Special methods 2
__enter__
__enter__(self: Self)
__exit__
__exit__(self: Self)
function timing
timing(msg: str = "") -> TimeInterval

Example usage:

from time import timing
with timing('foo function'):
foo() # prints runtime of foo
class struct_time
@tuple
class struct_time
Constructors 1
__new__
__new__(year: int = 0, /, mon: int = 0, mday: int = 0, hour: int = 0, min: int = 0, sec: int = 0, wday: int = 0, yday: int = 0, isdst: int = 0) -> struct_time
Properties 9
tm_year
@property
tm_year(self: Self) -> int
tm_yday
@property
tm_yday(self: Self) -> int
tm_sec
@property
tm_sec(self: Self) -> int
tm_min
@property
tm_min(self: Self) -> int
tm_hour
@property
tm_hour(self: Self) -> int
tm_mday
@property
tm_mday(self: Self) -> int
tm_mon
@property
tm_mon(self: Self) -> int
tm_wday
@property
tm_wday(self: Self) -> int
tm_isdst
@property
tm_isdst(self: Self) -> int
function localtime
localtime(secs: int = -1, /) -> struct_time
function gmtime
gmtime(secs: int = -1, /) -> struct_time
function mktime
mktime(t, /) -> int