diff --git a/pep-0418/clock_precision.py b/pep-0418/clock_precision.py index c8c57d494..39629e1dc 100644 --- a/pep-0418/clock_precision.py +++ b/pep-0418/clock_precision.py @@ -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)