Timer accuracy??? -RFH ( Request for Help) 
Author Message
 Timer accuracy??? -RFH ( Request for Help)

We are trying to use the timers in VB to time an external event,
however we seem to be getting a timing error of about 5sec/min.
This is demonstrated by setting up a timer with an interval of
1000mS and using it to update a counter. The count is 'losing'
about 50sec in 10mins.
What are we doing wrong??


Fri, 01 May 1998 03:00:00 GMT  
 Timer accuracy??? -RFH ( Request for Help)

Quote:

>We are trying to use the timers in VB to time an external event,
>however we seem to be getting a timing error of about 5sec/min.
>This is demonstrated by setting up a timer with an interval of
>1000mS and using it to update a counter. The count is 'losing'
>about 50sec in 10mins.
>What are we doing wrong??

The timer interval is not truly a interval, but rather a frequency.

In your timer event, check the timer() function and compare it to the
value of the timer() function at the start of your interval. (the
timer function returns the number of seconds since midnight.)  Use the
interval property of the timer control to control the *accuracy* of
your timing loop rather than using it to establish the elapsed time
itself.  (ie. setting the interval smaller causes the timer_event to
fire more frequently and thus you can check the value of the timer()
function more often.

Using this method, you are limited only by the accuracy of the system
clock which is available to VB.  We used it to obtain an accuracy of
about 15ms (if I remember correctly) on a one second control loop
interval.  

HTH




Fri, 01 May 1998 03:00:00 GMT  
 Timer accuracy??? -RFH ( Request for Help)
Because the accuracy of a timer depends on the system clock
rate and how often the application retrieves messages from the
message queue, the time-out value is only approximate.

--
Tim Pearson

http://www.starwave.com



Fri, 01 May 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Timer Accuracy - Help !

2. Timer, accuracy in millisecs!

3. Timer Function Accuracy

4. vb timer accuracy ???

5. Accuracy of Timers in VB5

6. Timer with high accuracy

7. Timer Accuracy

8. Wanted: VB3 Timer with millisecond accuracy.

9. timer accuracy of mmsystem.dll

10. Accuracy of timers in VB?

11. Timer accuracy

12. Timer accuracy

 

 
Powered by phpBB® Forum Software