From 1f0a43bf013a6bfd0ded24b6e2867c44e3a897d2 Mon Sep 17 00:00:00 2001 From: joxe Date: Mon, 21 Jun 2010 19:07:24 +0000 Subject: [PATCH] fixed timer bug - did not do equality comparison --- core/sys/timer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/sys/timer.c b/core/sys/timer.c index d8a602daa..9fcb54b06 100644 --- a/core/sys/timer.c +++ b/core/sys/timer.c @@ -42,7 +42,7 @@ * * Author: Adam Dunkels * - * $Id: timer.c,v 1.7 2010/06/21 09:41:49 joxe Exp $ + * $Id: timer.c,v 1.8 2010/06/21 19:07:24 joxe Exp $ */ #include "contiki-conf.h" @@ -121,9 +121,9 @@ timer_restart(struct timer *t) int timer_expired(struct timer *t) { - clock_time_t diff = clock_time() - t->start; - /* Can not return diff >= t->interval so we need to return + /* Note: Can not return diff >= t->interval so we add 1 to diff and return t->interval < diff - required to avoid an internal error in mspgcc. */ + clock_time_t diff = (clock_time() - t->start) + 1; return t->interval < diff; }