icpc-jag / rime

Rime: Automation Tool for Programming Contest Organizers
MIT License
45 stars 28 forks source link

Replace time.clock() by time.process_time() #80

Closed arosh closed 4 years ago

arosh commented 4 years ago

In Python 3.8.5, rime build -j 4 shows the following error.

$ rime build -j 4
Traceback (most recent call last):
  File "/home/sho_iizuka/workspace/domestic-2020/venv/lib/python3.8/site-packages/rime/core/main.py", line 144, in Main
    return InternalMain(args)
  File "/home/sho_iizuka/workspace/domestic-2020/venv/lib/python3.8/site-packages/rime/core/main.py", line 125, in InternalMain
    graph.Run(task)
  File "/home/sho_iizuka/workspace/domestic-2020/venv/lib/python3.8/site-packages/rime/core/taskgraph.py", line 404, in Run
    self.first_tick = time.clock()
AttributeError: module 'time' has no attribute 'clock'
$ python -V
Python 3.8.5
$

time.process_time() was introduced in Python 3.3, and time.clock() was removed in Python 3.8.

See https://docs.python.org/3.7/library/time.html#time.clock

arosh commented 4 years ago

I had a misunderstanding. time.perf_counter seems to be better than time.process_time for our usecase.

arosh commented 4 years ago

Duplicate of #77