From 23733e76424d0bf621ce5dbb5bbe8b20dfc0d5f6 Mon Sep 17 00:00:00 2001 From: wangchengdong Date: Fri, 7 Nov 2025 11:11:49 +0800 Subject: [PATCH] sched/clock: Fix missing clock_inittime() call The current implementation only calls clock_inittime() when RTC is enabled, which causes it to be skipped on other architectures. This patch ensures clock_inittime() is invoked during clock initialization for all cases. Signed-off-by: Chengdong Wang --- sched/clock/clock_initialize.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sched/clock/clock_initialize.c b/sched/clock/clock_initialize.c index 36f1749d5d3..dc5ec9605bf 100644 --- a/sched/clock/clock_initialize.c +++ b/sched/clock/clock_initialize.c @@ -151,7 +151,6 @@ int clock_basetime(FAR struct timespec *tp) * ****************************************************************************/ -#ifdef CONFIG_RTC static void clock_inittime(FAR const struct timespec *tp) { /* (Re-)initialize the time value to match the RTC */ @@ -187,7 +186,6 @@ static void clock_inittime(FAR const struct timespec *tp) clock_inittimekeeping(tp); #endif } -#endif /**************************************************************************** * Public Functions @@ -220,12 +218,13 @@ void clock_initialize(void) up_rtc_initialize(); -#if !defined(CONFIG_RTC_EXTERNAL) +#endif + +#if !defined(CONFIG_RTC_EXTERNAL) || \ + !defined(CONFIG_RTC) /* Initialize the time value to match the RTC */ clock_inittime(NULL); -#endif - #endif perf_init();