]> git.webhop.me Git - lcd4linux.git/commitdiff
BUG: handle negative delays in timer_process() (timer.c)
authormzuther <mzuther@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sun, 7 Feb 2010 02:52:59 +0000 (02:52 +0000)
committermzuther <mzuther@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sun, 7 Feb 2010 02:52:59 +0000 (02:52 +0000)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1105 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

timer.c

diff --git a/timer.c b/timer.c
index dfdb6e85eecf3d03d965c9c274761d8aacf2ca61..212c392e5b270ecb3c39041aa0e540d646c783a9 100644 (file)
--- 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;