diff options
| author | Bernard Xiong <[email protected]> | 2021-03-27 14:22:10 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-03-27 14:22:10 +0800 |
| commit | ec6d7075396a0db52c8a8ba9def5666bc3c5c78c (patch) | |
| tree | 7af0018a53bb3841ef6e63976acd027ba7c884ed /components | |
| parent | 459a70bf0d531c07986b085980520a3165d403d4 (diff) | |
| parent | 0ec2a5f78222a22a242f730ad9b45b763604bae4 (diff) | |
Merge pull request #4526 from mysterywolf/time1
[libc][time] add LOG_W to give a warning when RTC device is not used
Diffstat (limited to 'components')
| -rw-r--r-- | components/libc/compilers/common/time.c | 5 |
1 files changed, 4 insertions, 1 deletions
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 <sys/time.h> #include <rtthread.h> +#include <rtdbg.h> #ifdef RT_USING_DEVICE #include <rtdevice.h> #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 */ |
