Which is better to use for timing in Python? time.clock() or time.time()? Which one provides more accuracy?
for example:
start = time.clock()
... do
clock()
-> floating point number
Return the CPU time or real time since the start of the process or since
the first call to clock()
. This has as much precision as the system
records.
time()
-> floating point number
Return the current time in seconds since the Epoch. Fractions of a second may be present if the system clock provides them.
Usually time()
is more precise, because operating systems do not store the process running time with the precision they store the system time (ie, actual time)