Problem with Timer firing reliably

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Can anyone suggest a fool-proof way to execute a procedure *reliably*
at a certain time of day?

I have an app that runs 24/7. There are several activities that need
to be done each day at a specified time. To handle this, I have a
timer that runs with its interval set to 1000 ms. Every time it fires,
I display the time on the main screen using this statement:
frmMain.StatusBar1.Panels(3).Text =
Format$(Time$, " H:MM:SS AMPM")

I then capture the displayed value like so:
TimeCaption$ = Trim$(frmMain.StatusBar1.Panels(3).Text)

And compare it to the scheduled times when things need to happen, thus
(for example):

If TimeCaption$ = "7:59:55 AM" Then Call SomeProcedure()


I've been using this approach for several years in a lot of different
installations and it seems to work just fine about 99.999% of the
time.

The problem is, it does not work 100% of the time. Once in a great
while (like once or twice a year), SomeProcedure does not get called.
I am assuming that once in a great while, something will bog down the
computer at just the wrong moment and the timer will fire late and the
time caption will go from "7:59:54 AM" to 7:59:56 AM" and thus I'll
never get the match I'm looking for.

I've considered putting in a "latch" that would be set when the
procedure DOES execute and then check that at "7:59:56 AM" and, if it
was not set, then call the procedure. Is this the "best" way to handle
it?

Any other thoughts as to how to fix this?

Thanks.
.



Relevant Pages

  • timer/progress bar on splash screen
    ... When my app starts, it reads in a few text files. ... would like to display a progress bar. ... Do I need a timer? ...
    (microsoft.public.dotnet.framework.compactframework)
  • RE: Countdown timer
    ... I have noticed that if any other Excel workbook is open on the same pc, ... the countdown timer appears in I1 in the other workbooks too. ... All New code - will display correct time remaining, ... Dim TimePassed As Long ...
    (microsoft.public.excel.programming)
  • Re: Medusa 3rd Player Display Flashes when solenoid fires.
    ... And while you have them out check the connector on the display ... Do all pop bumpers. ... Phantom solenoid firing can be cause by bad connections on MPU J4 and SDB ... one of the pop-bumpers fires another fires right after it (only ...
    (rec.games.pinball)
  • Re: Stumped, baffled, and perplexed.......
    ... mostly audio content, about 8 hours of "talking book" spoken material. ... I want the video track to contain nothing more than a large displayed ... clock / timer which shows the elapsed time since the beginning of the ... I would expect the display would read: ...
    (rec.video.production)
  • Re: posix-cpu-timers revamp
    ... Tests with a process CPU timer set for a long expiration time. ... interval as set by setitimer. ... the first time it fires at the value set by setitimerbut from then on ... The current value of an itimer is a user feature, ...
    (Linux-Kernel)