time.clock() problem under linux (precision=0.01s)

Mike Meyer mwm at mired.org
Fri Aug 19 04:47:28 CEST 2005

"Szabolcs Nagy" <nszabolcs at gmail.com> writes:

> time.time seems much better solution, but python manual sais: "not all
> systems provide time with a better precision than 1 second"
> Should i use time.clock or time.time to be more crossplatform?
> Is time.time ok for windows? (time()-time() != 0.0)

You should use the timeit module, which chooses the correct timer to
use for the platform it's running on, as well as working around a
number of other things that trip up people trying to benchmark code.

Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

More information about the Python-list mailing list