| |
|
|
Sven Bader | since some Time have I the trouble, that &gettickcount and sleep only yet on ca. 16 ms very works. In combination could one Sleep 1 with folgendem code 0 or even 31 ms spend!
former I had the trouble not but it shining neither unnormal To his. either coming it through one windows-Update or a BIOS-attitude (letztes I will yet validieren).
with timeBeginPeriod have I a API-function found, which The dissolution of Sleep again on reliable 1 ms bring can. The following Beispielquelltext uses creep with apiece 100 Durchläufen, there &gettickcount as always inaccurate operates.
in the Screenshot shows itself the Difference, presumably is the yet available Error of 0.79 ms on Loop + API-appeal zurückzuführen.
in the best drop have your on eurem computer with both Durchläufen the same good Result.
Declare caps#, start&
Dim caps#,8'Timer Intervalle mins/max read
Decimals 2
Def timeGetDevCaps(2) !"winmm","timeGetDevCaps"
Def timeBeginPeriod(1) !"winmm","timeBeginPeriod"
Def timeEndPeriod(1) !"winmm","timeEndPeriod"
Window (%maxx * 0.5 - 250), (%maxy * 0.5 - 262) - 500,524
start& = &gettickcount
WhileLoop 100
Sleep 1
EndWhile
Print "sleep 1 lasting durchschnittlich: " + st$((&gettickcount - start&) * 0.01) + " ms"
timeGetDevCaps(caps#,8)'dissolution the Timers inquire (caps# = mins ms, max ms)
Print "\nSetze Timer-dissolution on kleinstmöglichen worth: " + st$(long(caps#,0)) + " ms \n"
timeBeginPeriod(long(caps#,0))'minimale dissolution the Timers settle, there on manchen Systemen Sleep otherwise only 15ms exactly!!
start& = &gettickcount
WhileLoop 100
Sleep 1
EndWhile
Print "sleep 1 lasting durchschnittlich: " + st$((&gettickcount - start&) * 0.01) + " ms"
timeEndPeriod(long(caps#,0))'before gesetzte minimale Timer-release zurücksetzen
Dispose caps#
WaitInput
|
|
|
| |
|
|