English
Source / code snippets

accuracy of Sleep (timeGetDevCaps / timeBeginPeriod)

 

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!
Declare start&
start& = &gettickcount
sleep 1
print (&gettickcount - start&)

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

8 kB
Hochgeladen:02/02/23
Downloadcounter55
Download
 
02/02/23  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.091 Views

Untitledvor 0 min.
ScanMaster06/20/24
Sven Bader08/11/23
Wilfried Friebe05/28/23
funkheld05/14/23
More...

Themeninformationen

this Topic has 1 subscriber:

Sven Bader (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie