[Tinyos-help] synchronisation

wafa jaballah wafa.jaballah at gmail.com
Fri Nov 19 03:21:15 PST 2010


I want to calculate the global and local time of the packet transmission in
sender, then the local and global time of reception of the packet in
receiver side. And I want to use these calculations in order to get for
example the clock drift . My object is to synchronise my nodes and
essentially get the clock drift between sender and receiver in order to have
a loose synchronisation.

I was confused because I have read many methods to get these two values.

First, I can in the send command and receive command get these values by

         x= call GlobalTime.getLocalTime();
          printf("local time is %ld\n",x);
          call GlobalTime.local2Global(&x);
          printf("global time is %ld\n", x);
 so I can calculate these two values both in sender and receiver.

Second, I can use also in the event receive:

          uint32_t rxTimestamp = call PacketTimeStamp.timestamp(data);
          printf ("local rx_timestamp is %ld \n",rxTimestamp );
          is_synced = call GlobalTime.local2Global(&rxTimestamp);
          printf ("global is %ld\n", rxTimestamp);

And Also, we can compute these two values (local and global).

Third, in TEP133 in tinyos, there are the notion of packet-level time
synchronisation which is exposed through two interfaces TimeSyncAMSend and
The former allows for sending a time value and the send command performs
sender receiver time synchronisation. The the receiver can obtain this time
value expressed in its local time via TimeSyncPacket.
And Therefore, we can compute this time value both in sender local clock and
receiver local clock. and we can get the difference of clocks (or clock

Which method, could I adopt? The first one seems work for me.   In which
case, Have I to adopt  the first one? I'm right?

Your help is very appreciated,
Thanks in advance,


Best Regards,
Wafa Ben Jaballah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20101119/92da6667/attachment-0001.htm 

More information about the Tinyos-help mailing list