aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormzuther <mzuther@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2011-02-12 22:46:19 +0000
committermzuther <mzuther@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2011-02-12 22:46:19 +0000
commitf17287509f698f21f38ae047a306ddca3fc13140 (patch)
treee9e0c09fb2ee1d6dd0eaa82365bb101308660f03
parent5e69b1e3961ee896d44107c05650c915d9b24298 (diff)
downloadlcd4linux-f17287509f698f21f38ae047a306ddca3fc13140.tar.gz
timer.c: fixed detection of positive clock skew (and some typos)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1143 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r--drv_USBLCD.c2
-rw-r--r--drv_picoLCD.c2
-rw-r--r--drv_picoLCDGraphic.c2
-rw-r--r--timer.c14
4 files changed, 10 insertions, 10 deletions
diff --git a/drv_USBLCD.c b/drv_USBLCD.c
index 89dac62..093ea0f 100644
--- a/drv_USBLCD.c
+++ b/drv_USBLCD.c
@@ -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;
diff --git a/drv_picoLCD.c b/drv_picoLCD.c
index b971775..84dccb3 100644
--- a/drv_picoLCD.c
+++ b/drv_picoLCD.c
@@ -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;
diff --git a/drv_picoLCDGraphic.c b/drv_picoLCDGraphic.c
index b5652e7..e6889c8 100644
--- a/drv_picoLCDGraphic.c
+++ b/drv_picoLCDGraphic.c
@@ -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 d4545cb..61de79e 100644
--- 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)) {