[Tinyos-devel] Confusing Comment in TimeSyncMsg.h (tos/lib/ftsp)

Miklos Maroti mmaroti at math.u-szeged.hu
Tue Mar 17 02:57:40 PDT 2009


Hi Thomas,

Yes the comment is wrong because it was correct before FTSP was
converted to use the TimeSyncAMSend interface. The globalTime field is
always contain the globalTime measured at some instant X by the sender
node. This value is NOT changed. The localTime is the localTime of the
sender measured at the same instant X. The TimeSync component changes
the localTime to localTime - transmitTime when the message is sent, so
the time offset is transmitted over the radio. On the receiving side
this time offset is converted back to localTime for the receiver by
calculating timeOffset + receiveTime. In the mean time, globalTime
never changes. Does that make sense?

(By the way Brano, we could have saved 4 bytes from the
TimeSyncMessage by changing the event time to LocalTime - GlobalTime,
which is the localTime when the GlobalTime overflowed. This difference
is what all we need on the receiver side. (However, this would be even
harder to follow and understand, so I am not going to change this)

Miklos

On Mon, Mar 16, 2009 at 11:27 PM, Thomas Schmid <thomas.schmid at ucla.edu> wrote:
> Hey all,
>
> Digging deeper into the time stamping mechanism I found a comment in
> TimeSyncMsg.h which is misleading:
>
>    /* This field is initially set to the offset between global time and local
>     * time. The TimeStamping component will add the current local time when the
>     * message is actually transmitted. Thus the receiver will receive the
>     * global time of the sender when the message is actually sent. */
>    nx_uint32_t globalTime;
>
>
> After TEP 133 (and what the code implements) this is not correct.
> GlobalTime is the time of the event, but the local timestamp on the
> receiving side gets adjusted by the difference between the event time
> and the time the message was actually sent out. The globalTime field
> never gets touched! Following is an attempt on fixing this comment:
>
> Index: TimeSyncMsg.h
> ===================================================================
> RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/ftsp/TimeSyncMsg.h,v
> retrieving revision 1.2
> diff -r1.2 TimeSyncMsg.h
> 35,38c35,44
> <       /* This field is initially set to the offset between global
> time and local
> <        * time. The TimeStamping component will add the current local
> time when the
> <        * message is actually transmitted. Thus the receiver will receive the
> <        * global time of the sender when the message is actually sent. */
> ---
>>     /*
>>      * After TEP 133, the message timestamp contains the difference between
>>      * event time and the time the message was actually sent out. TimeSyncP
>>      * sends the local time associated with this globalTime to the
>>      * TimeStamping mechanism, which then calculates the difference.
>>      *
>>      * On the receiving side, the difference is applied to the local
>>      * timestamp. The receiving timestamp thus represents the time on the
>>      * receiving clock when the remote globalTime was taken.
>>      */
> _______________________________________________
> Tinyos-devel mailing list
> Tinyos-devel at millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-devel
>



More information about the Tinyos-devel mailing list