]> git.webhop.me Git - lcd4linux.git/commitdiff
BUG: compensate timers for processing delay ("timer.c")
authormzuther <mzuther@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sat, 6 Feb 2010 21:42:05 +0000 (21:42 +0000)
committermzuther <mzuther@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sat, 6 Feb 2010 21:42:05 +0000 (21:42 +0000)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1103 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

timer.c

diff --git a/timer.c b/timer.c
index 3ae864bc44a2258847b708e494945a9a134349ed..a38b76bf2ebae1b76d51ca220fb15574e47074f7 100644 (file)
--- 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);