Python的time模块的clock方法在不同平台的效果不同

time.clock()

On Unix, return the current processor time as a floating point number expressed in seconds. The precision, and in fact the very definition of the meaning of “processor time”, depends on that of the C function of the same name, but in any case, this is the function to use for benchmarking Python or timing algorithms.

On Windows, this function returns wall-clock seconds elapsed since the first call to this function, as a floating point number, based on the Win32 function QueryPerformanceCounter(). The resolution is typically better than one microsecond.

在Linux平台下,用time.clock()计时不准,所以还是都用time.time()吧。

本文首发于博客园,任何其他站点均为爬虫或转载,爬虫最无耻。
原文地址:https://www.cnblogs.com/codeape/p/2825890.html