一,两个函数的文档: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()为基础,它比毫秒表示更为精确)
(未完待续)