On this page
time.monotonic_ns
Prev: time.monotonic | Up: time | Next: time.perf_counter
Rel: time.asctime, time.clock_getres, time.clock_gettime, time.clock_gettime_ns
Ref: docs.python.org — time.monotonic_ns
Tags: #public #python3 #stdlib #time
Import
import time
from time import monotonic_ns
Signature & Overview
time.monotonic_ns()
Monotonic clock, cannot go backward, as nanoseconds.
Usage
import time
t0 = time.monotonic_ns()
t1 = time.monotonic_ns()
assert isinstance(t1 - t0, int) and t1 >= t0
Gotchas
- Avoids float precision loss: Returns an exact
intin nanoseconds.
REPL Inspect
from time import monotonic_ns
help(monotonic_ns)
Linked from
Related notes
- tuts/python3/stdlib_module/time/monotonic Linked here; links to this page; shared tags: #stdlib, #time
- tuts/python3/stdlib_module/time/perf_counter Linked here; links to this page; shared tags: #stdlib, #time
- tuts/python3/stdlib_module/time/asctime Linked here; shared tags: #stdlib, #time
- tuts/python3/stdlib_module/time/clock_getres Linked here; shared tags: #stdlib, #time
- tuts/python3/stdlib_module/time/clock_gettime Linked here; shared tags: #stdlib, #time
- tuts/python3/stdlib_module/time/clock_gettime_ns Linked here; shared tags: #stdlib, #time
- tuts/python3/stdlib_module/time/time Linked here; shared tags: #stdlib, #time
- tuts/python3/stdlib_module/time links to this page; shared tags: #stdlib
- tuts/c/stdlib/time shared tags: #stdlib, #time
- tuts/c/stdlib/time/asctime shared tags: #stdlib, #time