[issue44681] time.sleep(0.001) not working properly

2021-07-28 Thread Eryk Sun
Eryk Sun added the comment: > It certainly wouldn't be worth the power and CPU usage > impact that people would inevitable get tricked into > causing To clarify, only short waits such as time.sleep(0.001) would busy loop. Waits longer than say 50 ms would call WaitForSingleObjectEx() or Sle

[issue44681] time.sleep(0.001) not working properly

2021-07-27 Thread Steve Dower
Steve Dower added the comment: > Maybe it would be useful to implement something like this in time.sleep() > itself, but I don't know whether the need in a few cases warrants the > increased complexity and cost in general. It certainly wouldn't be worth the power and CPU usage impact that pe

[issue44681] time.sleep(0.001) not working properly

2021-07-20 Thread Eryk Sun
Eryk Sun added the comment: The implementation of time.sleep() uses WaitForSingleObjectEx() on the main thread. It waits for an event object that gets signaled by Ctrl+C. On other threads it simply calls Sleep(). Thread wait functions such as WaitForSingleObjectEx() and Sleep() are based on

[issue44681] time.sleep(0.001) not working properly

2021-07-20 Thread Thereisfood
Thereisfood added the comment: I think this is Windows 10 issue after build 1909. Because I tested on Windows 10 build 1909 is about 0.001 - 0.002 and tested on 20H2 is the attached results. -- ___ Python tracker

[issue44681] time.sleep(0.001) not working properly

2021-07-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: Jack, Thereisfood is using Windows, which I understand has a clock with millisecond accuracy. So a sleep of a millisecond should, I think, work on Windows even if it doesn't work on Linux. Could a Windows expert clarify please? -- nosy: +steven.da

[issue44681] time.sleep(0.001) not working properly

2021-07-19 Thread Thereisfood
Change by Thereisfood : -- stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsub

[issue44681] time.sleep(0.001) not working properly

2021-07-19 Thread Jack DeVries
Jack DeVries added the comment: This is not a bug. See the docs: The precision of the various real-time functions may be less than suggested by the units in which their value or argument is expressed. E.g. on most Unix systems, the clock “ticks” only 50 or 100 times a second. On the other ha

[issue44681] time.sleep(0.001) not working properly

2021-07-19 Thread Thereisfood
Change by Thereisfood : Added file: https://bugs.python.org/file50162/Capture.PNG ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue44681] time.sleep(0.001) not working properly

2021-07-19 Thread Thereisfood
Change by Thereisfood : Removed file: https://bugs.python.org/file50161/Capture.PNG ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue44681] time.sleep(0.001) not working properly

2021-07-19 Thread Thereisfood
New submission from Thereisfood : time.sleep(0.001) sleeps for 0.014 - 0.016 instead of 0.001. -- components: Windows files: Capture.PNG messages: 397850 nosy: paul.moore, steve.dower, therenoisfood, tim.golden, zach.ware priority: normal severity: normal status: open title: time.sleep(