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

Thomas Schmid thomas.schmid at ucla.edu
Mon Mar 16 15:27:12 PDT 2009


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.
>      */


More information about the Tinyos-devel mailing list