sched: return 0 from clock_systime_ticks if failed
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
parent
415fe60695
commit
3cd5e20f74
@ -1655,7 +1655,7 @@ void up_timer_initialize(void);
|
|||||||
* set a time in the future and get an event when that alarm goes off.
|
* set a time in the future and get an event when that alarm goes off.
|
||||||
*
|
*
|
||||||
* int up_alarm_cancel(void): Cancel the alarm.
|
* int up_alarm_cancel(void): Cancel the alarm.
|
||||||
* int up_alarm_start(FAR const struct timespec *ts): Enable (or re-anable
|
* int up_alarm_start(FAR const struct timespec *ts): Enable (or re-enable
|
||||||
* the alarm.
|
* the alarm.
|
||||||
* #else
|
* #else
|
||||||
* int up_timer_cancel(void): Cancels the interval timer.
|
* int up_timer_cancel(void): Cancels the interval timer.
|
||||||
|
@ -84,13 +84,18 @@ clock_t clock_systime_ticks(void)
|
|||||||
|
|
||||||
/* Get the time from the platform specific hardware */
|
/* Get the time from the platform specific hardware */
|
||||||
|
|
||||||
clock_systime_timespec(&ts);
|
if (clock_systime_timespec(&ts) == OK)
|
||||||
|
{
|
||||||
|
/* Convert to a 64-bit value in microseconds,
|
||||||
|
* then in clock tick units.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Convert to a 64-bit value in microseconds,
|
return timespec_to_tick(&ts);
|
||||||
* then in clock tick units.
|
}
|
||||||
*/
|
else
|
||||||
|
{
|
||||||
return timespec_to_tick(&ts);
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@ -101,12 +106,24 @@ clock_t clock_systime_ticks(void)
|
|||||||
|
|
||||||
#if defined(CONFIG_SCHED_TICKLESS_TICK_ARGUMENT)
|
#if defined(CONFIG_SCHED_TICKLESS_TICK_ARGUMENT)
|
||||||
clock_t ticks;
|
clock_t ticks;
|
||||||
up_timer_gettick(&ticks);
|
if (up_timer_gettick(&ticks) == OK)
|
||||||
return ticks;
|
{
|
||||||
|
return ticks;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#elif defined(CONFIG_SCHED_TICKLESS)
|
#elif defined(CONFIG_SCHED_TICKLESS)
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
up_timer_gettime(&ts);
|
if (up_timer_gettime(&ts) == OK)
|
||||||
return timespec_to_tick(&ts);
|
{
|
||||||
|
return timespec_to_tick(&ts);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#elif defined(CONFIG_SYSTEM_TIME64)
|
#elif defined(CONFIG_SYSTEM_TIME64)
|
||||||
|
|
||||||
clock_t sample;
|
clock_t sample;
|
||||||
|
Loading…
Reference in New Issue
Block a user