Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Event Timing
Message
From
16/08/2003 02:56:14
 
 
To
15/08/2003 16:16:38
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00820657
Message ID:
00820716
Views:
16
>How can I get an event to fire according to elapsed system time seconds. the timer seemes to work different on faster or slower computers.

What exactly are you trying to do? What sort of event firing interval are you trying to use (seconds, minutes, hours)?

A few general points about this sort of thing:

- The time it takes for your code to process the event must be (in practice, significantly) less than the timer interval. If your timer fires every 3 seconds, but the processing takes 5 seconds, you've got a mess. However, this is one area where a faster computer can make a real difference, in reducing the processing time.

- Under some conditions the VFP Timer doesn't fire. IIRC there is a download here that can help in some of these cases: A form independent, enhanced timer fll File #9315

- You need to think carefully about what is "good enough" accuracy when expecting an event to fire (or, in practice, when you want the related processing to be complete). It takes a so-called "real-time" operating system to give accurately timed responses to events. Consumer-grade versions of Windows are definitely *not* real-time. At any time during the processing of your event, Windows may decide to let OE check and download new mail, a defragger start a disk defrag or any other manner of things that the 20+ processes running on your typical NT/W2K/XP box might want to do at that moment. Another variable - by default, foreground tasks in Windows are more responsive than background tasks, so running your job in the background may make it slower and subject to greater timing variances. All in all, there are lots of things going on in the typical Windows box that think they have as much, or more rights, than your process to hog up resources and processing time.

What can you expect in practice? If you want an event to fire and process say, once per second with an accuracy of +/- 2 milliseconds, it won't be reliable. It may work most of the time, maybe even almost all of the time, but from time to time it will get interrupted as outlined above and the interval will be out of spec. This will be true both of the timing of the firing of the event itself, and the time at which your processing of that event is expected to be complete.

At the other extreme, if you want something to fire every minute, and it doesn't really matter if it finishes at 60.2 seconds or 61.2 seconds, then that should be achievable in VFP on consumer Windows.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform