[Tinyos-help] local and global time using FTSP in my app

wafa jaballah wafa.jaballah at gmail.com
Sun Nov 14 09:24:44 PST 2010


Hello,

I want to calculate the local and global time in the receiver's side in
order to do use them in further calculations so I have used the following
code:

event message_t*  RadioReceive.receive(message_t*  data, void* payload,
uint8_t len ) {

   uint8_t is_synced;
      call Leds.led0Toggle();

 if ( call PacketTimeStamp.isValid(data)) {

       uint32_t rxTimestamp = call PacketTimeStamp.timestamp(data);

      printf ("local rx_timestamp is %ld \n",rxTimestamp );

     is_synced = call GlobalTime.local2Global(&rxTimestamp);

     printf ("global rx_timestamp is %ld and skew is %ld and %ld :\n",
rxTimestamp,(uint32_t)call TimeSyncInfo.getSkew()*1000000UL,

     call TimeSyncInfo.getSeqNum());

      printf ("report is synchronised is %ld \n", is_synced);
                  }
//some codes
......
.....

}

I have also do the appropritate wiring of my components in my configuration
file.

When running these in my telosb motes , I found that I have the value of
LocalTime and Global Time are the same. Here is some output related to this

Thread[Thread-1,5,main] local rx_timestamp is 29457
global rx_timestamp is 29457 and skew is 0 and 1930493952 :
report is synchronised is -1633550335
received data packet  1
local rx_timestamp is 39635
global rx_timestamp is 39635 and skew is 0 and -1697447936 :
report is synchronised is -1633550335
received data packet  2
......
......
I don't know how could I correct this since I have used the global time
interface and  PacketTimeStamp which are recommended.

Any help will be 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/20101114/4aa55be2/attachment.htm 


More information about the Tinyos-help mailing list