Windows cannot guarantee a precisely regular callback for a timer, so you will definitely see that kind of variance.
You need to take a different approach:
- Initialise a
Stopwatch
field in your class. - Call
Stopwatch.Restart()
when you want to reset the timing. - Inside
updateTimeElapsed()
useStopwatch.Elapsed
instead ofpurelyTime
.
Note that your code is completely ignoring the amount of time spent in the timer handler function itself. Inside the handler, you are using Invoke to send a message to the UI and waiting for it to return. That can take an arbitrary amount of time, particularly if the UI is busy.