[issue20505] Remove resolution from selectors and granularity from asyncio
STINNER Victor
report at bugs.python.org
Mon Feb 10 23:01:45 CET 2014
STINNER Victor added the comment:
> How do you know that the timer used by the select/poll/etc. call has the same resolution?
If I understood correctly, there a 3 kind of clocks on Windows:
- kernel heartbeat: GetSystemTimeAdjustment() gives the resolution (a few milliseconds)
- multimedia timers
- performance counter: the resolution is 1 / QueryPerformanceFrequency() (at least 1 microsecond)
GetSystemTimeAsFileTime() (time.time), GetTickCount[64]() (time.monotonic) and GetProcessTimes() (time.process_time) use the kernel heartbeat (I invented this name :-)). GetTickCount() is not adjusted.
QueryPerformanceCounter() is the performance counter, it is used by time.perf_counter().
GetSystemTimeAdjustment():
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724394%28v=vs.85%29.aspx
For more information, see the PEP 418:
http://www.python.org/dev/peps/pep-0418/
> Can the clock resolution be zero?
There is a unit test to ensure that the resolution of all clocks is greater than 0 and smaller or equal than 1.0.
> If not, I recommend adjusting the comparisons so that an event scheduled at exactly the rounded-up 'now' value is not considered ready -- it should be strictly before.
Ok, here is an updated patch.
----------
Added file: http://bugs.python.org/file34027/clock_resolution-2.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20505>
_______________________________________
More information about the Python-bugs-list
mailing list