ibell / pdsim

Steady-State simulation code for positive displacement machines
MIT License
38 stars 23 forks source link

time.clock deprecated since py3.3 removed py3.8 #57

Closed danieldjewell closed 3 years ago

danieldjewell commented 3 years ago

According to the Python3.7 documentation on the time module, time.clock() has been deprecated since py3.3 and was indeed removed in py3.8 thus breaking pdsim at least here (and in other places):

https://github.com/ibell/pdsim/blob/d957202a53503508442aa5a325091482eb1f13bd/PDSim/core/core.py#L5

I recognize that at least in the conda env file, python 3.7 is targeted -- but since we're on the cusp of 3.9 being final (looks like 3.9.0rc2 was released on 2020-09-24) and 3.8 is reasonably mainstream, I thought it might be useful to document this.

I haven't gone through the code yet to see where/how clock() is being used but it seems at first glance that time.process_time() might be a drop-in replacement.

davideziviani commented 3 years ago

@danieldjewell : we are aware of that issue and we have a few other issues with py3.8 . A PR is welcome.

ibell commented 3 years ago

timeit.default_timer is my go-to for timing. Uses most accurate timer available

ibell commented 3 years ago

This is a fix for the GUI part at least: https://github.com/ibell/pdsim/commit/025319e573fc38d969b54811c2291e2b31059456 . Same solution for core/core.py