Windows gotcha #23923234
Typically when writing code in Windows (desktop or mobile), you will encounter a strange bug in the operating system which requires a workaround. This has been occuring since the very first version of Windows and is still happening today. Lately I have been having odd timing problems with my games on some devices and was trying to discover the reason behind it. On OMAP devices (both PPC + SP) the PerformanceCounter doesn’t really exist and it returns a resolution of 1ms. Under the covers it uses the system tick counter which has a resolution of 1 millisecond. This would be reasonable if it worked as expected, but for some reason, querying the performance counter gives stops and starts and will cause games which depend on this to go both too fast and too slow. The solution is to check the timer frequency with QueryPerformanceFrequency() and if it comes back as 1000, then use the GetTickCount() function instead of the PerformanceCounter functions.
1 Comment »
Leave a comment
-
Recent
- Windows Vista killed my laptop battery :(
- New performance figures for the JPEG codec on ARM
- WM 6.1 – A Tale of Two Operating Systems
- A Graphics Library for Windows Mobile (could run on BREW, Symbian too)
- A good tool to save electricity
- Get your music without spending a bundle
- Supermarket club cards are a waste of everyone’s time
- Tiny JPEG
- Windows Mobile 6 Phone Roundup
- More JPEG Optimization
- My new T-Mobile Shadow
- SN76496 in ARM asm
-
Links
-
Archives
- June 2009 (1)
- January 2009 (1)
- December 2008 (1)
- November 2008 (1)
- October 2008 (4)
- April 2008 (1)
- March 2008 (3)
- February 2008 (6)
- January 2008 (2)
- December 2007 (1)
- November 2007 (1)
- October 2007 (2)
-
Categories
-
RSS
Entries RSS
Comments RSS
Yeah I recently noticed this too… I just stuck with using GetTickCount(). It seems to do the job quite well…. or am I deluding myself?