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

Branislav Kusy branislav.kusy at gmail.com
Mon Nov 15 19:29:29 PST 2010


On 15/11/2010, at 4:26 AM, wafa jaballah <wafa.jaballah at gmail.com> wrote:

> 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
Global and local times will be the sMe at the root node. Try
programming multiple nodes.

> Thread[Thread-1,5,main] local rx_timestamp is c29457
> 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
>
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


More information about the Tinyos-help mailing list