lib_localtime: gmtime_r should get right time in OS init process
Enable CONFIG_LIBC_LOCALTIME,CONFIG_RTC and CONFIG_SCHED_TICKLESS In os clock init process, clock_initialize() --> ... --> sim_rtc_rdtime() --> gmtime_r() --> gmtsub() --> return NULL get the error rtctime. Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
This commit is contained in:
parent
0bff62e3e8
commit
8b84d19771
@ -59,6 +59,7 @@
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/init.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/mutex.h>
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user