Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / DBP Platform Timer = 1ms, can this be changed?

Author
Message
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 21st Jun 2011 18:23
I have been running some tests, trying to make my game more energy efficient for netbooks. The big stumbling block seems to be the takeover of the Platform Timer.

By default it is set to 15.6 by Windows. Some apps set it to 10 (e.g Chrome). I need to unset this if possible during idle times (Menu screen).

I've tried IanM's NICE SLEEP, and although this gives time back to the OS, it doesn't change the Platform Timer.

Can this be achieved? Even if by a DLL call, if all else fails?

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Booma
17
Years of Service
User Offline
Joined: 29th Mar 2009
Location:
Posted: 21st Jun 2011 20:20 Edited at: 21st Jun 2011 20:49
You can use this functions from ntdll.dll

NtSetTimerResolution http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/Time/NtSetTimerResolution.html
NtQueryTimerResolution http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/Time/NtQueryTimerResolution.html

or functions from Winmm.dll

timeGetDevCaps() to get resolution
timeBeginPeriod() to set resolution

P.S.

IanM in his plugin use timeGetDevCaps() timeBeginPeriod() and TimeEndPeriod()
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 22nd Jun 2011 01:57
I will try the SET TIMER RESOLUTION at the next opportunity, thanks Ian.

Booma, I will bear your information in mind as a backup, thanks.

WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 22nd Jun 2011 03:18
Sorry but Hmmm noted... Very handy to know... (thinking about interrupt timers)

Warning! May contain Nuts!

Login to post a reply

Server time is: 2026-07-10 14:05:13
Your offset time is: 2026-07-10 14:05:13