0

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

fsidiosidi
  • 51
  • 3
  • 12

2 Answers2

2

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

datenwolf
  • 159,371
  • 13
  • 185
  • 298
1

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

Erik
  • 88,732
  • 13
  • 198
  • 189