Added a function for converting a timesynchronized time to a local (rtimer) time
This commit is contained in:
parent
8a9b931a4b
commit
c8dccbbd40
2 changed files with 19 additions and 3 deletions
|
@ -34,7 +34,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: timesynch.c,v 1.2 2008/01/14 14:50:01 adamdunkels Exp $
|
* $Id: timesynch.c,v 1.3 2008/01/23 15:07:05 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,6 +80,12 @@ timesynch_time_to_rtimer(rtimer_clock_t synched_time)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
rtimer_clock_t
|
rtimer_clock_t
|
||||||
|
timesynch_rtimer_to_time(rtimer_clock_t rtimer_time)
|
||||||
|
{
|
||||||
|
return rtimer_time + offset;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
rtimer_clock_t
|
||||||
timesynch_offset(void)
|
timesynch_offset(void)
|
||||||
{
|
{
|
||||||
return offset;
|
return offset;
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: timesynch.h,v 1.2 2008/01/14 14:50:02 adamdunkels Exp $
|
* $Id: timesynch.h,v 1.3 2008/01/23 15:07:05 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,7 +91,7 @@ void timesynch_init(void);
|
||||||
rtimer_clock_t timesynch_time(void);
|
rtimer_clock_t timesynch_time(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get the current time-synchronized rtimer time, suitable for use with the rtimer module
|
* \brief Get the current time-synchronized time, suitable for use with the rtimer module
|
||||||
* \return The current time-synchronized rtimer time
|
* \return The current time-synchronized rtimer time
|
||||||
*
|
*
|
||||||
* This function returns the (local) rtimer-equivalent
|
* This function returns the (local) rtimer-equivalent
|
||||||
|
@ -103,6 +103,16 @@ rtimer_clock_t timesynch_time(void);
|
||||||
*/
|
*/
|
||||||
rtimer_clock_t timesynch_time_to_rtimer(rtimer_clock_t synched_time);
|
rtimer_clock_t timesynch_time_to_rtimer(rtimer_clock_t synched_time);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get the synchronized equivalent of an rtimer time
|
||||||
|
* \return The synchronized equivalent of an rtimer time
|
||||||
|
*
|
||||||
|
* This function returns the time synchronized equivalent
|
||||||
|
* time corresponding to a (local) rtimer time.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
rtimer_clock_t timesynch_rtimer_to_time(rtimer_clock_t rtimer_time);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get the current time-synchronized offset from the rtimer clock, which is used mainly for debugging
|
* \brief Get the current time-synchronized offset from the rtimer clock, which is used mainly for debugging
|
||||||
* \return The current time-synchronized offset from the rtimer clock
|
* \return The current time-synchronized offset from the rtimer clock
|
||||||
|
|
Loading…
Reference in a new issue