This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients gvanrossum, neologix, python-dev, vstinner
Date 2014-02-10.22:01:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1392069705.98.0.110407583505.issue20505@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2014-02-10 22:01:46vstinnersetrecipients: + vstinner, gvanrossum, neologix, python-dev
2014-02-10 22:01:45vstinnersetmessageid: <1392069705.98.0.110407583505.issue20505@psf.upfronthosting.co.za>
2014-02-10 22:01:45vstinnerlinkissue20505 messages
2014-02-10 22:01:45vstinnercreate