Quote Originally Posted by Clootie
Quote Originally Posted by Fran
There is however one major downside to using it. It's very inacurate. Sleep(1) will return 1-15ms later, rarely 1. With nothing else happening on the system, the average on my fast computer is 2-3ms, but as soon as something else is going on, it's 10-15ms.
As it's already been said: call timeBeginPeriod(1); and measure your accuracy again. You should be surprized!
I certainly will, at one time i needed very high accuracy, and used some rather esoteric methods to achieve it. The only reason i never tried timebeginperiod is because the documentation says it's only for the multimedia timers, i never expected it to work on sleep.

In any case, i'll be testing this within the week under some pretty large workloads and heavy thread usage. I'll post here the results with/without those 2 lines of code.