]> git.webhop.me Git - lcd4linux.git/commitdiff
timer.c: fixed detection of positive clock skew (and some typos)
authormzuther <mzuther@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sat, 12 Feb 2011 22:46:19 +0000 (22:46 +0000)
committermzuther <mzuther@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sat, 12 Feb 2011 22:46:19 +0000 (22:46 +0000)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1143 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

drv_USBLCD.c
drv_picoLCD.c
drv_picoLCDGraphic.c
timer.c

index 89dac627064190813cfefd069797a64026bd127a..093ea0f0ea6f9f496691ea24f8da9daf5b71182a 100644 (file)
@@ -337,7 +337,7 @@ static int drv_UL_start(const char *section, const int quiet)
     /* Init the command buffer */
     Buffer = (char *) malloc(1024);
     if (Buffer == NULL) {
-       error("%s: coommand buffer could not be allocated: malloc() failed", Name);
+       error("%s: command buffer could not be allocated: malloc() failed", Name);
        return -1;
     }
     BufPtr = Buffer;
index b971775496a32b09fc41a2dd55793640bb2ee44b..84dccb3347245d65674d3bd3b7e3092b5fba848d 100644 (file)
@@ -306,7 +306,7 @@ static int drv_pL_start(const char *section, const int quiet)
     /* Init the command buffer */
     Buffer = (char *) malloc(1024);
     if (Buffer == NULL) {
-       error("%s: coommand buffer could not be allocated: malloc() failed", Name);
+       error("%s: command buffer could not be allocated: malloc() failed", Name);
        return -1;
     }
     BufPtr = Buffer;
index b5652e743eafc8830b79b414671662eb304c04ff..e6889c8082cd3b6d5f7d96aef4eee08bad7d6a03 100644 (file)
@@ -520,7 +520,7 @@ static int drv_pLG_start(const char *section, const int quiet)
     /* Init the command buffer */
     Buffer = (char *) malloc(1024);
     if (Buffer == NULL) {
-       error("%s: coommand buffer could not be allocated: malloc() failed", Name);
+       error("%s: command buffer could not be allocated: malloc() failed", Name);
        return -1;
     }
     BufPtr = Buffer;
diff --git a/timer.c b/timer.c
index d4545cbdb1f678c7d8256da08fb026ec918ac4ca..61de79e639ab23a4e65093d57d0d0bd34aa6c1bd 100644 (file)
--- a/timer.c
+++ b/timer.c
@@ -443,16 +443,16 @@ int timer_process(struct timespec *delay)
        in "diff" */
     timersub(&Timers[next_timer].when, &now, &diff);
 
-    /* convert "diff" to milliseconds */
-    int time_difference = (diff.tv_sec * 1000.0f) + (diff.tv_usec / 1000.0f);
-
-    /* a notable negative delay has occurred (positive clock skew or
-       some timers are faster than the time needed for processing
-       their callbacks) */
-    if (time_difference < (-CLOCK_SKEW_DETECT_TIME_IN_MS)) {
+    /* a negative delay has occurred (positive clock skew or some
+       timers are faster than the time needed for processing their
+       callbacks) */
+    if (diff.tv_sec < 0) {
        /* zero "diff" so the next update is triggered immediately */
        timerclear(&diff);
     } else {
+       /* convert "diff" to milliseconds */
+       int time_difference = diff.tv_sec * 1000 + diff.tv_usec / 1000;
+
        /* if there is a notable difference between "time_difference" and
           the next upcoming timer's interval, assume clock skew */
        if (time_difference > (Timers[next_timer].interval + CLOCK_SKEW_DETECT_TIME_IN_MS)) {