time.time or time.clock
Ron Adam
rrr at ronadam.com
Sun Jan 13 15:05:58 EST 2008
I'm having some cross platform issues with timing loops. It seems
time.time is better for some computers/platforms and time.clock others, but
it's not always clear which, so I came up with the following to try to
determine which.
import time
# Determine if time.time is better than time.clock
# The one with better resolution should be lower.
if time.clock() - time.clock() < time.time() - time.time():
clock = time.clock
else:
clock = time.time
Will this work most of the time, or is there something better?
Ron
More information about the Python-list
mailing list