Behaviour of System.Timer when Interval property changed
- by lowlyintern
I have a System.Timer setup to trigger an event every day at 2AM.
If the process the timer starts fails then I want the timer
to be reset to run every 15 minutes until the process completes succesfully.
// this is how the timer is set up.
// this is working correctly.
double startTime = milliseconds_of_hour_to_start.
Timer = new System.Timers.Timer( startTime);
Here is the code to reset the timer on success or failure of the event handler. NOTE the timer is not being stopped,
just the Interval property is being reset.
if (ProcessSuccess)
{
Timer.Interval = TimeSpan.FromHours(24).TotalMilliseconds;
}
else
{
Timer.Interval = TimeSpan.FromMinutes(15).TotalMilliseconds;
}
My question is this, if the process fails say 4 times, then succeeds will the Timer now be running at around 3AM?
i.e. after failing will the original start time of 2AM be advanced by 15 minutes?