]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
change the time stamp calculation to never round up into the future
authormmaroti <mmaroti>
Mon, 12 Apr 2010 09:21:20 +0000 (09:21 +0000)
committermmaroti <mmaroti>
Mon, 12 Apr 2010 09:21:20 +0000 (09:21 +0000)
(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

index 87898e2c5d759adf32ad320a21f17b3b93db7571..79250cf34817aef8b151c56561c9cda38289f3e6 100644 (file)
@@ -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);
   }
 
   /**