siwiher
asked on
Accurate Timer
Hi there, I'm making a stopwatch program and i've hit a glitch.
I thought evreything was working perfectly until I compared a minute on my program and a minute on the computer's clock.
The two times were 3 seconds apart.
I am using the Ttimer component to count out 100 miliseconds to the second and 60 seconds to the minute.
Please help, Siwiher!
I thought evreything was working perfectly until I compared a minute on my program and a minute on the computer's clock.
The two times were 3 seconds apart.
I am using the Ttimer component to count out 100 miliseconds to the second and 60 seconds to the minute.
Please help, Siwiher!
You should not count events.
StartTime := GetTickCount;
or better (higher resolution)
QueryPerformanceCounter(St artTime)
and then
CurrentTime := GetTickCont;
TimeElapsed := CurrentTime-StartTime;
QueryPerformanceCounter(Cu rrentTime)
QueryPerformanceFrequency( Freq)
TimeElapsed := (1000*(CurrentTime-StartTi me)) div Freq;
StartTime := GetTickCount;
or better (higher resolution)
QueryPerformanceCounter(St
and then
CurrentTime := GetTickCont;
TimeElapsed := CurrentTime-StartTime;
QueryPerformanceCounter(Cu
QueryPerformanceFrequency(
TimeElapsed := (1000*(CurrentTime-StartTi
ASKER
mokule >>
please could i have have a workin example - the code above looks like latin to me!
please could i have have a workin example - the code above looks like latin to me!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Brilliant Mokule thanks very much!
it's a component of the JVCL library
get it at http://homepages.borland.com/jedi/jvcl/