sciapp / python-gr

Python wrapper for the GR framework
https://gr-framework.org
Other
30 stars 8 forks source link

Use time.perf_counter() instead of the deprecated time.clock() #5

Closed link2xt closed 5 years ago

link2xt commented 5 years ago

time.clock() is deprecated since Python 3.3.

FlorianRhiem commented 5 years ago

Sorry for the delayed reply.

I think we should keep the code Python 2 compatible, even the examples, at least until Python 2 has reached its end-of-life by the end of the year. As clock will be removed in Python 3.8 and 3.8 is scheduled to be released in Oktober, we can't just wait for Python 2 to be retired before changing this. :)

Could you update the pull request to make the use of clock or perf_counter dependent on whether perf_counter is available? e.g. something like:

try:
    from time import perf_counter
except ImportError:
    from time import clock as perf_counter 
link2xt commented 5 years ago

@FlorianRhiem Added Python 2 compatibility and rebased.

FlorianRhiem commented 5 years ago

Thank you, we've merged the commits into the develop branch and they'll be in the next release.