一,兩個函數的文檔:html
1,time.time():python
Return the time in seconds since the epoch 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.express
—————————————————————————————————————————————ide
返回從紀元(1970.1.1)至今的秒數。雖然這個函數的返回值永遠爲浮點數,但並非全部系統提供的秒數都會精確到小數點之後。通常狀況下這個函數的返回值不會小於它上一次被調用的返回值,除非系統時鐘在兩次調用之間發生了重置。 函數
2,time.clock():this
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. orm
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.htm
—————————————————————————————————————————————教程
在Unix 中,將當前的處理器時間以浮點數的形式返回,單位爲秒。它的精確度(準確地說是「處理器時間」的精確度)取決於同名的C函數,不管如何,這個函數是python關於時間計算的標尺。 進程
WINDOWS中,第一次調用,返回的是進程運行的實際時間。而第二次以後的調用是自第一次調用之後到如今的運行時間。(其實是以WIN32上QueryPerformanceCounter()爲基礎,它比毫秒錶示更爲精確)
(未完待續)