aboutsummaryrefslogtreecommitdiffstats
path: root/timer.c
diff options
context:
space:
mode:
authormzuther <mzuther@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2010-02-06 21:42:05 +0000
committermzuther <mzuther@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2010-02-06 21:42:05 +0000
commitfd89168c6b1e62541f8aa683c6d03a1d19eba7e5 (patch)
tree199f4fd424b5ebce21508bea9c524edba5301aa4 /timer.c
parent43aef95679f4be26c5fb99c03d18118de3006f03 (diff)
downloadlcd4linux-fd89168c6b1e62541f8aa683c6d03a1d19eba7e5.tar.gz
BUG: compensate timers for processing delay ("timer.c")
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1103 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'timer.c')
-rw-r--r--timer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/timer.c b/timer.c
index 3ae864b..a38b76b 100644
--- a/timer.c
+++ b/timer.c
@@ -180,7 +180,6 @@ int timer_process(struct timespec *delay)
if (Timers[i].one_shot) {
Timers[i].active = 0;
} else {
- Timers[i].when = now;
timer_inc(&Timers[i].when, Timers[i].interval);
}
}
@@ -203,6 +202,9 @@ int timer_process(struct timespec *delay)
return -1;
}
+ /* update the current moment to compensate for processing delay */
+ gettimeofday(&now, NULL);
+
/* delay until next timer event */
struct timeval diff;
timersub(&Timers[min].when, &now, &diff);