[Python-Dev] time.clock() on windows

Antoine Pitrou solipsis at pitrou.net
Thu Oct 22 11:09:34 CEST 2009


Robert Collins <robertc <at> robertcollins.net> writes:
> 
> Could you offset it by the system time on the first call?

Two problems:
- the two measurements are not done simultaneously, so the result *still* does
not guarantee you have the same time reference in all processes (but gives you
the illusion you do, which is perhaps worse)
- adding a precise measure to an imprecise measure doesn't make the result
precise, but imprecise (or, rather, precise but inexact); in other words, if the
system time only gives a 0.01 second resolution, adding a high-resolution timer
only gives you an illusion of accuracy

Therefore it seems a very bad solution. The only way, AFAICT, to do this right
is for Windows to provide a high-resolution system time. It sounds astonishing
that this doesn't exist.

Regards

Antoine.




More information about the Python-Dev mailing list