]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/cc2420/transmit/CC2420TransmitP.nc
added more documentation to the getTime32 function
[tinyos-2.x.git] / tos / chips / cc2420 / transmit / CC2420TransmitP.nc
index 87898e2c5d759adf32ad320a21f17b3b93db7571..f1f47d0ae0e76474617aaf04e439b91752dac278 100644 (file)
@@ -255,11 +255,13 @@ implementation {
   async command void RadioBackoff.setCca(bool useCca) {
   }
   
-  
-  inline uint32_t getTime32(uint16_t time)
+  // this method converts a 16-bit timestamp into a 32-bit one
+  inline uint32_t getTime32(uint16_t captured_time)
   {
-    uint32_t recent_time=call BackoffTimer.getNow();
-    return recent_time + (int16_t)(time - recent_time);
+    uint32_t now = call BackoffTimer.getNow();
+
+    // the captured_time is always in the past
+    return now - (uint16_t)(now - captured_time);
   }
 
   /**