Closed Tacumi closed 6 years ago
I think time.process_time()
is not okay for that purpose, because it returns the CPU time of the current process, so it does not measure the actual time elapsed (it does not include e.g. the time spent in sleep).
I suggest using time.perf_counter()
instead.
Just check this:
time.process_time(); time.sleep(1); time.process_time()
vs.
time.perf_counter(); time.sleep(1); time.perf_counter()
For me the first one shows the same value before and after the 1 second sleep.
In the Python 3.7 environment, I received a warning of the deprecated function. By adding an if statement, it was fixed with Python 2.7 compatibility.