mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 17:33:08 +08:00
Move timespec calculations from sched into libc/sched
Allow using these functions also outside sched, where systick related calculations are performed Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
committed by
Xiang Xiao
parent
2d125d33d3
commit
c79d2067c7
@@ -394,6 +394,51 @@ void clock_resynchronize(FAR struct timespec *rtc_diff);
|
||||
clock_t clock_systime_ticks(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: clock_time2ticks
|
||||
*
|
||||
* Description:
|
||||
* Return the given struct timespec as systime ticks.
|
||||
*
|
||||
* NOTE: This is an internal OS interface and should not be called from
|
||||
* application code.
|
||||
*
|
||||
* Input Parameters:
|
||||
* reltime - Pointer to the time presented as struct timespec
|
||||
*
|
||||
* Output Parameters:
|
||||
* ticks - Pointer to receive the time value presented as systime ticks
|
||||
*
|
||||
* Returned Value:
|
||||
* Always returns OK (0)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int clock_time2ticks(FAR const struct timespec *reltime,
|
||||
FAR sclock_t *ticks);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: clock_ticks2time
|
||||
*
|
||||
* Description:
|
||||
* Return the given systime ticks as a struct timespec.
|
||||
*
|
||||
* NOTE: This is an internal OS interface and should not be called from
|
||||
* application code.
|
||||
*
|
||||
* Input Parameters:
|
||||
* ticks - Time presented as systime ticks
|
||||
*
|
||||
* Output Parameters:
|
||||
* reltime - Pointer to receive the time value presented as struct timespec
|
||||
*
|
||||
* Returned Value:
|
||||
* Always returns OK (0)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int clock_ticks2time(sclock_t ticks, FAR struct timespec *reltime);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: clock_systime_timespec
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user