From 0ec2a5f78222a22a242f730ad9b45b763604bae4 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Fri, 26 Mar 2021 17:36:43 +0800 Subject: [PATCH] [libc][time] add LOG_W to give a warning when RTC device is not used --- components/libc/compilers/common/time.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c index 083ae9be6c..286a173347 100644 --- a/components/libc/compilers/common/time.c +++ b/components/libc/compilers/common/time.c @@ -21,6 +21,7 @@ #include #include +#include #ifdef RT_USING_DEVICE #include #endif @@ -219,6 +220,7 @@ RT_WEAK time_t time(time_t *t) if(time_now == (time_t)-1) { + LOG_W("Cannot find a RTC device to provide time!"); errno = ENOSYS; } @@ -246,12 +248,13 @@ int stime(const time_t *t) } else { + LOG_W("Cannot find a RTC device to provide time!"); errno = ENOSYS; return -1; } return 0; - #else + LOG_W("Cannot find a RTC device to provide time!"); errno = ENOSYS; return -1; #endif /* RT_USING_RTC */