diff options
| author | Meco Jianting Man <[email protected]> | 2021-03-24 00:26:05 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-03-24 00:26:05 +0800 |
| commit | 8fccef5894812b07255d97338239c9d23a6735c1 (patch) | |
| tree | 1c02f5ffbb091cb14b4d68b13396d8d555c8e7fb /components/libc | |
| parent | 061182271fbf02cf5c3410e3c8083a062a31a2b3 (diff) | |
| parent | 50bf4902636eda180d33f12a52bb21a7d603bdf8 (diff) | |
Merge pull request #30 from RT-Thread/master
p
Diffstat (limited to 'components/libc')
| -rw-r--r-- | components/libc/compilers/common/time.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c index 0bad6bdf8e..083ae9be6c 100644 --- a/components/libc/compilers/common/time.c +++ b/components/libc/compilers/common/time.c @@ -16,6 +16,7 @@ * 2012-12-08 Bernard <clock_time.c> fix the issue of _timevalue.tv_usec initialization, * which found by Rob <[email protected]> * 2021-02-12 Meco Man move all of the functions located in <clock_time.c> to this file + * 2021-03-15 Meco Man fixed bug: https://club.rt-thread.org/ask/question/423650.html */ #include <sys/time.h> @@ -152,13 +153,14 @@ char* asctime_r(const struct tm *t, char *buf) num2str(buf + 20, (t->tm_year + 1900) / 100); num2str(buf + 22, (t->tm_year + 1900) % 100); buf[24] = '\n'; + buf[25] = '\0'; return buf; } RTM_EXPORT(asctime_r); char* asctime(const struct tm *timeptr) { - static char buf[25]; + static char buf[26]; return asctime_r(timeptr, buf); } RTM_EXPORT(asctime); |
