开发者

change clock's precision [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonabl开发者_如何学编程y answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

Env: Win Xp, Visual C++

I use clock() to measure the time cost in my program. But the t_clock always be the multiply of 10, for example 10, 20, 30, 40,... And I want to get the precision of 1, such as 11, 12, 13, 14... How can I change the t_clock's precision?

thanks


You can't; clock() uses the system's ordinary RTC. What you actually need to use are High Performance Timers. http://msdn.microsoft.com/en-us/magazine/cc163996.aspx


Use the timeBeginPeriod API call to increase resolution to 1ms.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜