[Tinyos-devel] Bug in timer system

Jan Hauer hauer at tkn.tu-berlin.de
Wed Mar 5 10:45:38 PST 2008


FYI: As agreed in the recent T2 core conference call I checked in the
suggested fix.
Jan

On Wed, Mar 5, 2008 at 5:55 PM, David Gay <dgay42 at gmail.com> wrote:
> On Tue, Mar 4, 2008 at 11:12 AM, Cory Sharp <cory at sentilla.com> wrote:
>  >  // Calculate "remaining" before the timer is fired. If a timer
>  >  // restarts itself in a fired event, then we 1) need a consistent
>  >  // "remaining" value to work with, and no worries because 2) all
>  >
>  >  // start commands post executeTimersNow, so the timer will be
>  >  // recomputed later, anyway.
>  >
>  >  int32_t elapsed = then - timer->t0;
>  >  int32_t remaining = timer->dt - elapsed;
>  >  bool compute_min_remaining = TRUE;
>  >
>  >
>  >  // If the elapsed time is negative, then t0 is in the future, so
>  >  // don't process it. This implies:
>  >  // 1) t0 in the future is okay
>  >  // 2) dt can be at most maxval(uint32_t)/2
>  >
>  >  if ((elapsed >= 0) && (timer->dt <= (uint32_t)elapsed))
>
>  The problem with this approach is that t0 is, by definition of the
>  Timer interface, always in the past (wrap-around support).
>
>  David
>
>
> _______________________________________________
>  Tinyos-devel mailing list
>  Tinyos-devel at millennium.berkeley.edu
>  https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-devel
>


More information about the Tinyos-devel mailing list