Reverted the timer_expired() back to the previous version (which should be correct). Removed the definition of CLOCK_LT() because it seems to only cause problems.

This commit is contained in:
adamdunkels 2009-01-24 15:20:11 +00:00
parent 3a4a961ff5
commit e346d8cf95
2 changed files with 6 additions and 4 deletions

View file

@ -53,13 +53,14 @@
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
* $Id: clock.h,v 1.10 2009/01/24 10:54:44 adamdunkels Exp $ * $Id: clock.h,v 1.11 2009/01/24 15:20:11 adamdunkels Exp $
*/ */
#ifndef __CLOCK_H__ #ifndef __CLOCK_H__
#define __CLOCK_H__ #define __CLOCK_H__
#include "contiki-conf.h" #include "contiki-conf.h"
#if 0 /* XXX problems with signedness and use in timer_expired(). #if:ed it out for now. */
/** /**
* Check if a clock time value is less than another clock time value. * Check if a clock time value is less than another clock time value.
* *
@ -68,7 +69,8 @@
* clock time values. * clock time values.
* *
*/ */
#define CLOCK_LT(a, b) ((clock_time_t)((a) - (b)) < 0) #define CLOCK_LT(a, b) ((clock_time_t)((a) - (b)) < ((clock_time_t)(~((clock_time_t)0)) >> 1))
#endif /* 0 */
/** /**
* Initialize the clock library. * Initialize the clock library.

View file

@ -42,7 +42,7 @@
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
* $Id: timer.c,v 1.4 2008/09/21 08:58:05 adamdunkels Exp $ * $Id: timer.c,v 1.5 2009/01/24 15:20:11 adamdunkels Exp $
*/ */
#include "contiki-conf.h" #include "contiki-conf.h"
@ -121,7 +121,7 @@ timer_restart(struct timer *t)
int int
timer_expired(struct timer *t) timer_expired(struct timer *t)
{ {
return CLOCK_LT(clock_time(), t->start + t->interval); return (clock_time_t)(clock_time() - t->start) >= (clock_time_t)t->interval;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**