I have made an exam application in C# that has a timer, while taking exam suppose the candidate keeps on pressing the windows’ minimize button (without releasing the mouse) at 1 minute and 30 seconds, the time pauses even if the candidate keeps on pressing the mouse for 10 minutes, but when the mouse is released the time resumes from the very second where it was paused i.e. 1 minute and 30 seconds. I want the timer to be continued without any pauses.
Share
What timer component are you using?
System.Windows.Forms.TimerorSystem.Threading.Timer?I suspect the
S.W.F.TimerusesSetTimerAPI call which uses window messages which would explain what you are seeing, a threaded timer would be better.You could also just use a thread, store a
DateTime.UtcNowand every 100ms or something in the thread, get anotherDateTime.UtcNowand check theTimeSpanfor the elapsed time.