]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
fix milli conversion (shift direction)
authormmaroti <mmaroti>
Mon, 9 Jun 2008 19:09:41 +0000 (19:09 +0000)
committermmaroti <mmaroti>
Mon, 9 Jun 2008 19:09:41 +0000 (19:09 +0000)
tos/chips/rf230/TimeSyncMessageP.nc

index a586b23a19d103a0bce9dbe16fc2e30caa04e6c4..c4f9ca3e55a90cde6db757e78f22e901de1cf54f 100644 (file)
@@ -122,7 +122,7 @@ implementation
        command error_t TimeSyncAMSendMilli.send[am_id_t id](am_addr_t addr, message_t* msg, uint8_t len, uint32_t event_time)
        {
                // compute elapsed time in millisecond
-               event_time = ((event_time - call LocalTimeMilli.get()) << 10) + call LocalTimeRadio.get();
+               event_time = ((int32_t)(event_time - call LocalTimeMilli.get()) << 10) + call LocalTimeRadio.get();
 
                return call TimeSyncAMSendRadio.send[id](addr, msg, len, event_time);
        }
@@ -183,6 +183,6 @@ implementation
        {
                timesync_relative_t* timesync = getFooter(msg);
 
-               return ((int32_t)(*timesync) << 10) + call PacketTimeStampMilli.timestamp(msg);
+               return ((int32_t)(*timesync) >> 10) + call PacketTimeStampMilli.timestamp(msg);
        }
 }