Decimals#
How to Use Decimals for Precision#
To set the number of decimals in the output (only if less than an hour), use the decimals
argument. Instead of the default value 2
for decimals
, you can set the output precision up to 9
in the decimals
argument:
Python | |
---|---|
Terminal output example:
Default Decimals and Supported Interval
Default value for decimals
is 2
. The range is minimum 0
(for no decimals) and up to 9
.
May be overruled in certain cases due to humanised output.
Set Decimals in Class Instance or Function#
It's also possible to set the decimals when initiating the Timer:
Python | |
---|---|
Terminal output example:
Or set the decimals when starting a new thread, which will also override the general decimals defined when initiating the Timer:
Python | |
---|---|
Terminal output example:
Precision in Nanoseconds
Timer for Python uses the native time.perf_counter_ns()
function for maximum resolution in nanoseconds.