From: mmaroti Date: Thu, 29 May 2008 19:03:04 +0000 (+0000) Subject: IRIS: reworked the time sync implementation X-Git-Tag: release_tinyos_2_1_0_0~362 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=767ff6e033b60d786e7fe0936cf387be52bc68d3 IRIS: reworked the time sync implementation --- diff --git a/tos/chips/rf230/RF230LayerP.nc b/tos/chips/rf230/RF230LayerP.nc index 1485d226..b2a9bb49 100644 --- a/tos/chips/rf230/RF230LayerP.nc +++ b/tos/chips/rf230/RF230LayerP.nc @@ -634,6 +634,7 @@ implementation if( isSpiAcquired() ) { uint16_t time; + uint32_t time32; uint8_t irq; uint8_t temp; @@ -713,7 +714,11 @@ implementation * CMD_TRANSMIT. */ if( irq == RF230_IRQ_RX_START ) // just to be cautious - call PacketTimeStamp.set(rxMsg, time - RX_SFD_DELAY); + { + time32 = call LocalTime.get(); + time32 += (int16_t)(time - RX_SFD_DELAY) - (int16_t)(time32); + call PacketTimeStamp.set(rxMsg, time32); + } else call PacketTimeStamp.clear(rxMsg);