renamed variable, rewrote comment to make easier to read

This commit is contained in:
joxe 2007-10-07 19:59:27 +00:00
parent 7fe87db86a
commit 35bff8238d

View file

@ -42,7 +42,7 @@
* *
* Author: Adam Dunkels <adam@sics.se> * Author: Adam Dunkels <adam@sics.se>
* *
* $Id: etimer.c,v 1.2 2006/10/09 16:05:58 nifi Exp $ * $Id: etimer.c,v 1.3 2007/10/07 19:59:27 joxe Exp $
*/ */
#include "contiki-conf.h" #include "contiki-conf.h"
@ -58,7 +58,7 @@ PROCESS(etimer_process, "Event timer");
static void static void
update_time(void) update_time(void)
{ {
clock_time_t nextt; clock_time_t tdist;
clock_time_t now; clock_time_t now;
struct etimer *t; struct etimer *t;
@ -67,14 +67,14 @@ update_time(void)
} else { } else {
now = clock_time(); now = clock_time();
t = timerlist; t = timerlist;
/* Must take current time into account due to wraps */ /* Must calculate distance to next time into account due to wraps */
nextt = t->timer.start + t->timer.interval - now; tdist = t->timer.start + t->timer.interval - now;
for(t = t->next; t != NULL; t = t->next) { for(t = t->next; t != NULL; t = t->next) {
if(t->timer.start + t->timer.interval - now < nextt) { if(t->timer.start + t->timer.interval - now < tdist) {
nextt = t->timer.start + t->timer.interval - now; tdist = t->timer.start + t->timer.interval - now;
} }
} }
next_expiration = nextt + now; next_expiration = now + tdist;
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/