From 42c536d3376434538d66d1b475b8a216e9abd086 Mon Sep 17 00:00:00 2001 From: mmaroti Date: Mon, 12 Apr 2010 09:21:20 +0000 Subject: [PATCH] change the time stamp calculation to never round up into the future (see the discussin with Steve McKown in tinyos-devel on 02/22/09) Committed on the Free edition of March Hare Software CVSNT Server. Upgrade to CVS Suite for more features and support: http://march-hare.com/cvsnt/ --- tos/chips/cc2420/transmit/CC2420TransmitP.nc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tos/chips/cc2420/transmit/CC2420TransmitP.nc b/tos/chips/cc2420/transmit/CC2420TransmitP.nc index 87898e2c..79250cf3 100644 --- a/tos/chips/cc2420/transmit/CC2420TransmitP.nc +++ b/tos/chips/cc2420/transmit/CC2420TransmitP.nc @@ -258,8 +258,10 @@ implementation { inline uint32_t getTime32(uint16_t time) { - uint32_t recent_time=call BackoffTimer.getNow(); - return recent_time + (int16_t)(time - recent_time); + uint32_t recent_time = call BackoffTimer.getNow(); + + // time is always in the past + return recent_time - (uint16_t)(recent_time - time); } /** -- 2.39.2