Maxim Khitrov wrote: > The threading module uses time.time in _Condition and _Thread classes > to implement timeouts. On Windows, time() typically has a resolution > of 15.625ms. In addition, if the system clock is changed (though ntp, > for example) it would reflect that change, causing the timeout to last > longer or shorter depending on which way the update went. > > Would it not be better to use time.clock() instead? The resolution is > much better, and the value is not linked to system clock. Right now, I > replace the threading._time reference with clock in some of my > programs and everything works perfectly. Condition and Event timeouts > are precise down to the millisecond (resolution of the sleep > function), and I see no side-effects. > > Is it possible to make that change part of the module itself (keeping > time() for linux systems), or can someone think of a reason why using > clock is a bad idea? I know that it's using QueryPerformanceCounter > for implementation, which has some known issues, but I still think > that the advantages outweigh potential faults.
Can you make a feature request? Your proposal seems sensible. A trivial patch should solve the issue: from time import sleep as _sleep if _sys.name == "win32": from time import clock as _time else: from time import time as _time However I'm not sure about the implications. Christian -- http://mail.python.org/mailman/listinfo/python-list