aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--timer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/timer.c b/timer.c
index dfdb6e8..212c392 100644
--- a/timer.c
+++ b/timer.c
@@ -210,6 +210,10 @@ int timer_process(struct timespec *delay)
struct timeval diff;
timersub(&Timers[min].when, &now, &diff);
+ /* for negative delays, directly trigger next update */
+ if ((diff.tv_sec < 0) || (diff.tv_usec < 0))
+ timerclear(&diff);
+
delay->tv_sec = diff.tv_sec;
/* microseconds to nanoseconds!! */
delay->tv_nsec = diff.tv_usec * 1000;