Sure. Here's how to do it:

module MyLocalTimeC {
 uses interface LocalTime<TMilli> as RealLocalTime;
 provides interface LocalTime<TMilli> as MyLocalTime;
 provides interface SetLocalTime<TMilli> as SetMyLocalTime;
} implementation {
 norace uint32_t offset;
 async command uint32_t MyLocalTime.get() {
   return offset + call RealLocalTime.get();
 }
 async command SetMyLocalTime.set(uint32_t myLocalTime) {
   offset = myLocalTime - call RealLocalTime.get();
 }
}

Of course, you will need to use the MyLocalTimeC component in your
application from now on, instead of HilTimerMilliC.

Janos

On Sun, Mar 1, 2009 at 4:35 PM, Robert Moore <[email protected]> wrote:
> Lei,
>
> Are you able to forward me any replies you got to this? I'm interested to
> know as well.
>
> Thanks
>
> Rob
>
> On Sat, Feb 28, 2009 at 10:29 AM, lei lu <[email protected]> wrote:
>>
>> Hi All,
>>
>> I just want to do a simple experiment: get the local time at the
>> transmitter side, put it in a packet and transmit to the receiver. For
>> receiver side, just set the local time according to what the packet content.
>> BUT I do not know how to set the local system time. Anyone can help?
>>
>> Thank you,
>>
>> Lei
>>
>> _______________________________________________
>> Tinyos-help mailing list
>> [email protected]
>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
>
>
> --
> Robert Moore
> 0400 7777 63
> Website Designer
> http://www.mooredesign.com.au/
> Web Support Officer - Curtin University
> http://www.curtin.edu.au/
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to