fixed timer bug - did not do equality comparison

This commit is contained in:
joxe 2010-06-21 19:07:24 +00:00
parent 2ca32f9c76
commit 1f0a43bf01

View File

@ -42,7 +42,7 @@
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
* $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" #include "contiki-conf.h"
@ -121,9 +121,9 @@ timer_restart(struct timer *t)
int int
timer_expired(struct timer *t) timer_expired(struct timer *t)
{ {
clock_time_t diff = clock_time() - t->start; /* Note: Can not return diff >= t->interval so we add 1 to diff and return
/* Can not return diff >= t->interval so we need to return
t->interval < diff - required to avoid an internal error in mspgcc. */ t->interval < diff - required to avoid an internal error in mspgcc. */
clock_time_t diff = (clock_time() - t->start) + 1;
return t->interval < diff; return t->interval < diff;
} }