PEP 418: Fix clock_precision.py, time.monotonic() is not always present
This commit is contained in:
parent
38da45e1bb
commit
64a87deb1f
|
@ -36,7 +36,11 @@ def test_clock(name, func):
|
|||
print("- precision in Python: %s" % format_duration(precision))
|
||||
|
||||
|
||||
for name in ('clock', 'perf_counter', 'process_time', 'monotonic', 'time'):
|
||||
clocks = ('clock', 'perf_counter', 'process_time')
|
||||
if hasattr(time, 'monotonic'):
|
||||
clocks.append('monotonic')
|
||||
clocks.append('time')
|
||||
for name in clocks:
|
||||
func = getattr(time, name)
|
||||
test_clock("%s()" % name, func)
|
||||
info = time.get_clock_info(name)
|
||||
|
|
Loading…
Reference in New Issue