[libc][time]优化警告输出内容

This commit is contained in:
Meco Man 2021-09-27 07:40:24 -04:00
parent 169b09004e
commit a74b0ae388
1 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@
#include <rtdevice.h> #include <rtdevice.h>
#endif #endif
#define DBG_TAG "TIME" #define DBG_TAG "time"
#define DBG_LVL DBG_INFO #define DBG_LVL DBG_INFO
#include <rtdbg.h> #include <rtdbg.h>
@ -242,7 +242,7 @@ char* asctime_r(const struct tm *t, char *buf)
/* Checking input validity */ /* Checking input validity */
if (rt_strlen(days) <= (t->tm_wday << 2) || rt_strlen(months) <= (t->tm_mon << 2)) if (rt_strlen(days) <= (t->tm_wday << 2) || rt_strlen(months) <= (t->tm_mon << 2))
{ {
LOG_W("The input exceeded the limit, please check it."); LOG_W("asctime_r: the input parameters exceeded the limit, please check it.");
*(int*) buf = *(int*) days; *(int*) buf = *(int*) days;
*(int*) (buf + 4) = *(int*) months; *(int*) (buf + 4) = *(int*) months;
num2str(buf + 8, t->tm_mday); num2str(buf + 8, t->tm_mday);