diff --git a/sched/clock/clock_initialize.c b/sched/clock/clock_initialize.c index 124efbf1707..490dfccc071 100644 --- a/sched/clock/clock_initialize.c +++ b/sched/clock/clock_initialize.c @@ -376,11 +376,7 @@ void clock_resynchronize(FAR struct timespec *rtc_diff) clock_t diff_ticks = SEC2TICK(rtc_diff->tv_sec) + NSEC2TICK(rtc_diff->tv_nsec); -#ifdef CONFIG_SYSTEM_TIME64 - atomic64_fetch_add((FAR atomic64_t *)&g_system_ticks, diff_ticks); -#else - atomic_fetch_add((FAR atomic_t *)&g_system_ticks, diff_ticks); -#endif + clock_increase_sched_ticks(diff_ticks); } } #endif diff --git a/sched/clock/clock_systime_ticks.c b/sched/clock/clock_systime_ticks.c index 04939bb19e6..debad32b7e0 100644 --- a/sched/clock/clock_systime_ticks.c +++ b/sched/clock/clock_systime_ticks.c @@ -88,31 +88,7 @@ clock_t clock_systime_ticks(void) up_timer_gettick(&ticks); return ticks; -#elif defined(CONFIG_SYSTEM_TIME64) - clock_t sample; - clock_t verify; - - /* 64-bit accesses are not atomic on most architectures. The following - * loop samples the 64-bit timer twice and loops in the rare event that - * there was 32-bit rollover between samples. - * - * If there is no 32-bit rollover, then: - * - * - The MS 32-bits of each sample will be the same, and - * - The LS 32-bits of the second sample will be greater than or equal - * to the LS 32-bits for the first sample. - */ - - do - { - verify = g_system_ticks; - sample = g_system_ticks; - } - while ((sample & TIMER_MASK32) < (verify & TIMER_MASK32) || - (sample & ~TIMER_MASK32) != (verify & ~TIMER_MASK32)); - - return sample; #else - return g_system_ticks; + return clock_get_sched_ticks(); #endif } diff --git a/sched/clock/clock_systime_timespec.c b/sched/clock/clock_systime_timespec.c index 2c8283f3419..02380fdb3fe 100644 --- a/sched/clock/clock_systime_timespec.c +++ b/sched/clock/clock_systime_timespec.c @@ -81,6 +81,6 @@ void clock_systime_timespec(FAR struct timespec *ts) defined(CONFIG_SCHED_TICKLESS) up_timer_gettime(ts); #else - clock_ticks2time(ts, g_system_ticks); + clock_ticks2time(ts, clock_get_sched_ticks()); #endif }