Subject: 26.2; timers sometimes stop working when coming back from sleep

From: ndame <[email-masked]>
Date: Fri, 28 Feb 2020 15:52:51 +0000 (GMT)

I use Emacs 26.2 on Windows and usually I send my computer to sleep,
instead of switching it off. That means the same Emacs instance runs
for weeks or even months unless Emacs crashes for some reason.

I use several timers for housekeeping tasks and they usually work, but
from time to time one of them fails to start after coming back from
sleep.

When I do an M-x list-timers the affected timer is still there, but
its value in the Next column is negative. The value keeps decreasing
like for other timers, but since the value is negative it gets farther
and farther from zero, so it never fires after that.

I assume some calculation between the real time and the expected
elapsed time sets the timer value to negative after sleep.

A possible fix may be to ensure that the Next value of the timer
cannot be negative.