mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 20:56:47 +08:00
sched/clock/: Don't call up_timer_gettime in clock_gettime and clock_systimer to ensure the return value from them consistent with clock_systimespec
This commit is contained in:
@@ -93,11 +93,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
|
|||||||
* reset.
|
* reset.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_SCHED_TICKLESS)
|
|
||||||
ret = up_timer_gettime(tp);
|
|
||||||
#else
|
|
||||||
ret = clock_systimespec(tp);
|
ret = clock_systimespec(tp);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@@ -118,13 +114,8 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
|
|||||||
|
|
||||||
#if defined(CONFIG_CLOCK_TIMEKEEPING)
|
#if defined(CONFIG_CLOCK_TIMEKEEPING)
|
||||||
ret = clock_timekeeping_get_wall_time(tp);
|
ret = clock_timekeeping_get_wall_time(tp);
|
||||||
#elif defined(CONFIG_SCHED_TICKLESS)
|
|
||||||
ret = up_timer_gettime(&ts);
|
|
||||||
#else
|
#else
|
||||||
ret = clock_systimespec(&ts);
|
ret = clock_systimespec(&ts);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CONFIG_CLOCK_TIMEKEEPING
|
|
||||||
if (ret == OK)
|
if (ret == OK)
|
||||||
{
|
{
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ clock_t clock_systimer(void)
|
|||||||
|
|
||||||
/* Get the time from the platform specific hardware */
|
/* Get the time from the platform specific hardware */
|
||||||
|
|
||||||
(void)up_timer_gettime(&ts);
|
(void)clock_systimespec(&ts);
|
||||||
|
|
||||||
/* Convert to a 64-bit value in microseconds, then in clock tick units */
|
/* Convert to a 64-bit value in microseconds, then in clock tick units */
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ clock_t clock_systimer(void)
|
|||||||
|
|
||||||
/* Get the time from the platform specific hardware */
|
/* Get the time from the platform specific hardware */
|
||||||
|
|
||||||
(void)up_timer_gettime(&ts);
|
(void)clock_systimespec(&ts);
|
||||||
|
|
||||||
/* Convert to a 64- then a 32-bit value */
|
/* Convert to a 64- then a 32-bit value */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user