aboutsummaryrefslogtreecommitdiffstats
path: root/timer.c
diff options
context:
space:
mode:
authormzuther <mzuther@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2010-02-07 02:52:59 +0000
committermzuther <mzuther@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2010-02-07 02:52:59 +0000
commitdcb29d2726791b4b770d4b36d27ee81d79a38f9e (patch)
tree171f62cb4fcb43b2512125e0832a378d70ba6e36 /timer.c
parent7a8ba6a1135800510b93621b78e6d0d3f53e0c2c (diff)
downloadlcd4linux-dcb29d2726791b4b770d4b36d27ee81d79a38f9e.tar.gz
BUG: handle negative delays in timer_process() (timer.c)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1105 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'timer.c')
-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;