devxlogo

Losing Timer Events

Losing Timer Events

Question:
When I start a timer on a window with an interval of one second, I expect to get a timer event on the window every second. I have noticed that if you have a command button on the window that opens another sheet, certain timer events are lost forever. While the sheet is being opened, the timer event is not received until the processor is busy opening the window. I therefore end up losing three to four timer events (or 3-4 seconds).

Though I lose these timer events I was expecting to get timer events that I had lost in immediate succession as it happens with the system clock. But what happens is different. The timer events, after whatever lost time, start coming again at intervals of 1 second, without adjusting for the number of seconds it had lost.

Answer:
This gets down to the Windows operating system. If your process (the window with the timer) is not processing the events quickly enough, Windows will not let the queue of events waiting on the timer event build up, so it will start to discard the timer events.

You will have to design/code your application to account for these lost seconds.

See also  Why ChatGPT Is So Important Today
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist