Thank you for this just me, it turned out to be interesting, also, I guess I didn't understand your querry at first (possibly, I still don't). I was a little surprised by the results from your script at first, but I hadn't realised that the A_TickCount had a precision of ~10ms, I assumed it was ~1ms. So that's was a good discovery.just me wrote:I said "on Win XP". You might want to try my test script:
I get sleeps in the range ~(1,20) ms measuring with the QPC function, measuring Sleep,1, so there doesn't seem to be any rounding the delay to 10 or 15.6 as the docs suggests (may happen).
Code: Select all
Sleep, 1 ; to 'sync' the script with A_TickCount
This seems to give more consitent sleeps:MSDN wrote:After the sleep interval has passed, the thread is ready to run. If you specify 0 milliseconds, the thread will relinquish the remainder of its time slice but remain ready. Note that a ready thread is not guaranteed to run immediately. Consequently, the thread may not run until some time after the sleep interval elapses.
Sleep
Code: Select all
S := A_TickCount
While (S=A_TickCount){
}
DllCall("QueryPerformanceCounter", "Int64P", C1)
Sleep, %SL%
DllCall("QueryPerformanceCounter", "Int64P", C2)