Microsoft makes no warranties, express or implied, with respect to the information provided here.
The following example instantiates a Timer object that fires its Timer.Elapsed event every two seconds (2000 milliseconds), sets up an event handler for the event, and starts the timer.
The Elapsed event is raised if the Enabled property is true and the time interval (in milliseconds) defined by the Interval property elapses.
If the AutoReset property is true, the event is raised repeatedly at an interval defined by the Interval property; otherwise, the event is raised only once, the first time the Interval value elapses.
If the SynchronizingObject property is null,the Elapsed event is raised on a ThreadPool thread.
If the processing of the Elapsed event lasts longer than Interval, the event might be raised again on another ThreadPool thread.
The example code for the Stop method shows one way to avoid this race condition. Even if SynchronizingObject is not null, Elapsed events can occur after the Dispose or Stop method has been called or after the Enabled property has been set to false, because the signal to raise the Elapsed event is always queued for execution on a thread pool thread.
One way to resolve this race condition is to set a flag that tells the event handler for the Elapsed event to ignore subsequent events.
This behavior is subject to change in future releases of .NET Framework. Sapling’s Elapsed Timer is a device that allows a user to shift the display on a digital clock from the time to a count up or countdown display.
Connected to a Sapling digital clock (3200 or 3300 series only), this device can be utilized in a variety of settings where keeping track of the elapsed time is needed.