Quote:Almost all games are time-based. Rare is the game that doesn’t require some use of a timer device. Unfortunately for game programmers, .NET wasn’t really designed with us in mind. The .NET framework was designed with application programmers in mind, so all it includes is a timer system that isn’t very accurate. When is the last time you saw a regular word-processing application require a millisecond-accuracy timer, anyway? Luckily for you and me, the DirectX team at Microsoft decided to fix this problem and gave us a handy, high-precision timer, with time accuracy that no sane game programmer would ever need.We’re talking about microsecond accuracy here. I’m happy with just milliseconds, though. ... Microsoft provided a file called DXUtil.cs that contains this timer, but it’s kind of hidden away in the SDK.You can find it if you go into the Samples\C#\Common directory inside wherever you installed the DirectX 9 SDK. Here’s an example of how to use the timer: float time = DXUtil.Timer( DirectXTimer.GetAbsoluteTime );How come theres nothing about this on the web? If thay made it for the C# .NET maybe theres one for C++?
Microsecond accuracy timer for C# but not for C++?
Reading the book "Beginning C# Game Programming" I found something very interesting. I have searched the google and this forum but could not find anything about it.
wrong link that was vb
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/queryperformancecounter.asp?frame=true
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/queryperformancecounter.asp?frame=true
Quote:Original post by dejangex
QueryPerformanceCounter is really microsecond accurate?
It is debatable, but it is generally accepted to be accurate to ~1 us. Note that a common misconception with timers is that just because they may be precise (ie the give results in very small units), they may not be accurate anywhere near that precision level.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement