diff --git a/sched/clock/clock.h b/sched/clock/clock.h index 6402d9a91d..0130559f8b 100644 --- a/sched/clock/clock.h +++ b/sched/clock/clock.h @@ -87,6 +87,8 @@ extern struct timespec g_basetime; * Public Function Prototypes ****************************************************************************/ +int clock_basetime(FAR struct timespec *tp); + void weak_function clock_initialize(void); #ifndef CONFIG_SCHED_TICKLESS void weak_function clock_timer(void); diff --git a/sched/clock/clock_initialize.c b/sched/clock/clock_initialize.c index dd4c2b4f72..b76ecde43d 100644 --- a/sched/clock/clock_initialize.c +++ b/sched/clock/clock_initialize.c @@ -91,7 +91,7 @@ struct timespec g_basetime; #if defined(CONFIG_RTC_DATETIME) /* Initialize the system time using a broken out date/time structure */ -static inline int clock_basetime(FAR struct timespec *tp) +int clock_basetime(FAR struct timespec *tp) { struct tm rtctime; long nsecs = 0; @@ -119,7 +119,7 @@ static inline int clock_basetime(FAR struct timespec *tp) /* Initialize the system time using a high-resolution structure */ -static inline int clock_basetime(FAR struct timespec *tp) +int clock_basetime(FAR struct timespec *tp) { /* Get the complete time from the hi-res RTC. */ @@ -130,7 +130,7 @@ static inline int clock_basetime(FAR struct timespec *tp) /* Initialize the system time using seconds only */ -static inline int clock_basetime(FAR struct timespec *tp) +int clock_basetime(FAR struct timespec *tp) { /* Get the seconds (only) from the lo-resolution RTC */ @@ -142,7 +142,7 @@ static inline int clock_basetime(FAR struct timespec *tp) #endif /* CONFIG_RTC_HIRES */ #else /* CONFIG_RTC */ -static inline int clock_basetime(FAR struct timespec *tp) +int clock_basetime(FAR struct timespec *tp) { time_t jdn = 0; diff --git a/sched/clock/clock_timekeeping.c b/sched/clock/clock_timekeeping.c index 8c3914bee9..5b60ddbd80 100644 --- a/sched/clock/clock_timekeeping.c +++ b/sched/clock/clock_timekeeping.c @@ -292,20 +292,9 @@ errout_in_critical_section: void clock_inittimekeeping(void) { - struct tm rtctime; - up_timer_getmask(&g_clock_mask); - - /* Get the broken-errout_in_critical_section time from the date/time RTC. */ - - (void)up_rtc_getdatetime(&rtctime); - - /* And use the broken-errout_in_critical_section time to initialize the - * system time. - */ - - g_clock_wall_time.tv_sec = mktime(&rtctime); - g_clock_wall_time.tv_nsec = 0; + clock_basetime(&g_clock_wall_time); + up_timer_getcounter(&g_clock_last_counter); } #endif /* CONFIG_CLOCK_TIMEKEEPING */