--- a/runtest.py +++ b/runtest.py @@ -92,8 +92,10 @@ try: import threading try: # python3 from queue import Queue + PY3=True except ImportError as e: # python2 from Queue import Queue + PY3=False threading_ok = True except ImportError: print("Can't import threading or queue") @@ -764,10 +766,13 @@ os.environ["python_executable"] = python # but time.time() does a better job on Linux systems, so let that be # the non-Windows default. -if sys.platform == 'win32': - time_func = time.clock -else: - time_func = time.time +try: + time_func = time.perf_counter +except AttributeError: + if sys.platform == 'win32': + time_func = time.clock + else: + time_func = time.time if print_times: print_time_func = lambda fmt, time: sys.stdout.write(fmt % time)