PDA

View Full Version : pc independent timer?



noeska
17-11-2003, 07:02 PM
I use a timer to call a procedure every 16ms. On my pc this works ok. But on another pc (cyrix 700mhz) it seems to mis half the calls. Is there a pc (speed) independent timer? It seems that 16ms is not equal on all pc's?

Thanks for your answer in advance!

cairnswm
17-11-2003, 08:04 PM
My Guess is that the program hasn't finished what you do inside the timer and therefore cant call it again until finished. (16ms is very quick).

Try the same program with a 100ms timer and see if it gives the same results on the two PCs. (Then you know its the processing speed).

From what I've heard

timegettime (uses MMSystem) is the most accurate timer.

Harry Hunt
17-11-2003, 09:51 PM
Use GetTickCount to see how long it takes to execute that procedure to find out if it's even possible to execute the code every 16ms.

noeska
19-11-2003, 07:19 PM
I am using the threaded timer from http://www.carlosb.com now. This solved my timing problem.

siim
20-11-2003, 10:19 PM
The GetTickCount is extremly inacurate. I tested it and its accuracy was something between 10 to 20 ms in my machine.

Look at my code in this thread:
http://terraqueous.f2o.org/dgdev/viewtopic.php?t=999
This is as accurate as you can get, I think. But I don't know about their platform independency.

Siim