time
-
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 anycase, this is the function to use for benchmarking Python or timing algorithms.
On Windows, this function returns wall-clock seconds elapsed since the firstcall to this function, as a floating point number, based on the Win32 functionQueryPerformanceCounter()
. The resolution is typically better than onemicrosecond. -
time.time()
Return the time in seconds since the epoch(1970年1月1日00:00:00) as a floating point number.Note that even though the time is always returned as a floating point number, not all systems provide time with a better precision than 1 second.While this function normally returns non-decreasing values, it can return a lower value than a previous call if the system clock has been set back between the two calls.
网友评论