diff --git a/libs/libc/time/lib_localtime.c b/libs/libc/time/lib_localtime.c index a5ad8fa8629..7cb33333234 100644 --- a/libs/libc/time/lib_localtime.c +++ b/libs/libc/time/lib_localtime.c @@ -59,6 +59,7 @@ #include #include +#include #include #include @@ -1768,7 +1769,7 @@ static FAR struct tm *gmtsub(FAR const time_t *timep, if (!g_gmt_isset) { #ifndef __KERNEL__ - if (up_interrupt_context() || sched_idletask()) + if (up_interrupt_context() || (sched_idletask() && OSINIT_IDLELOOP())) { return NULL; } @@ -2486,7 +2487,7 @@ void tzset(void) FAR const char *name; #ifndef __KERNEL__ - if (up_interrupt_context() || sched_idletask()) + if (up_interrupt_context() || (sched_idletask() && OSINIT_IDLELOOP())) { return; }