Python's time.clock() vs. time.time() accuracy?

后端 未结 16 1407
忘掉有多难
忘掉有多难 2020-11-22 08:22

Which is better to use for timing in Python? time.clock() or time.time()? Which one provides more accuracy?

for example:

start = time.clock()
... do          


        
16条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 09:06

    Depends on what you care about. If you mean WALL TIME (as in, the time on the clock on your wall), time.clock() provides NO accuracy because it may manage CPU time.

提交回复
热议问题