Skip to content

Commit

Permalink
sched/clock: call up_timer_gettime() to get higher resolution
Browse files Browse the repository at this point in the history
Signed-off-by: ligd <[email protected]>
  • Loading branch information
GUIDINGLI committed Dec 11, 2024
1 parent 5607eec commit 7e59f1e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
8 changes: 0 additions & 8 deletions include/nuttx/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,14 +332,6 @@ extern "C"
* access to kernel global data
*/

#ifdef __HAVE_KERNEL_GLOBALS
EXTERN volatile clock_t g_system_ticks;

# ifndef CONFIG_SYSTEM_TIME64
# define clock_systime_ticks() g_system_ticks
# endif
#endif

/****************************************************************************
* Public Function Prototypes
****************************************************************************/
Expand Down
4 changes: 3 additions & 1 deletion sched/clock/clock_systime_ticks.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ clock_t clock_systime_ticks(void)

up_timer_gettick(&ticks);
return ticks;
#elif defined(CONFIG_SCHED_TICKLESS)
#elif defined(CONFIG_ALARM_ARCH) || \
defined(CONFIG_TIMER_ARCH) || \
defined(CONFIG_SCHED_TICKLESS)
struct timespec ts =
{
0
Expand Down
4 changes: 3 additions & 1 deletion sched/clock/clock_systime_timespec.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ int clock_systime_timespec(FAR struct timespec *ts)

up_timer_gettick(&ticks);
clock_ticks2time(ts, ticks);
#elif defined(CONFIG_SCHED_TICKLESS)
#elif defined(CONFIG_ALARM_ARCH) || \
defined(CONFIG_TIMER_ARCH) || \
defined(CONFIG_SCHED_TICKLESS)
up_timer_gettime(ts);
#else
clock_ticks2time(ts, g_system_ticks);

Check failure on line 90 in sched/clock/clock_systime_timespec.c

View workflow job for this annotation

GitHub Actions / msys2 (msys2)

'g_system_ticks' undeclared (first use in this function)

Check failure on line 90 in sched/clock/clock_systime_timespec.c

View workflow job for this annotation

GitHub Actions / msys2 (msys2)

'g_system_ticks' undeclared (first use in this function)
Expand Down

0 comments on commit 7e59f1e

Please sign in to comment.