Python 3.3+Linux · macOStimefunction
time.clock_getres()
POSIX clocks
The resolution (reading step) of the system clock clk_id in seconds. Unix only: Linux and macOS; Windows lacks the function.
Syntax
time.clock_getres(clk_id)
Resolution is the step, not accuracy: 1e-09 for CLOCK_MONOTONIC does not mean the clock is never off by microseconds. The CLOCK_* constants also vary: CLOCK_BOOTTIME is Linux only, and touching a missing one raises AttributeError. The portable way to learn the same for the usual clocks is get_clock_info(name).resolution.
Examples
import time
res = time.clock_getres(time.CLOCK_MONOTONIC) # → ? на Windows AttributeError
print(res) # → ? 1e-09
print(res > 0) # → True
See also
Common errors
Open in the full glossarydocs.python.orgReport an inaccuracy