diff options
| author | Tangyuxin <[email protected]> | 2022-04-19 22:47:14 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-04-19 22:47:14 +0800 |
| commit | 20f5d934a9fbcf2e8cd5dcaa8acff85f5eca85da (patch) | |
| tree | 3b5e3271be3586b5db604c67a6d08f2d571fac74 /components/libc/compilers/common | |
| parent | 14d9709fdce9748efdd922ac5dc30687f9d21e80 (diff) | |
[libc][time] Fix bug (#5831)
Diffstat (limited to 'components/libc/compilers/common')
| -rw-r--r-- | components/libc/compilers/common/time.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c index 92a14e2d96..0bf38ca245 100644 --- a/components/libc/compilers/common/time.c +++ b/components/libc/compilers/common/time.c @@ -371,22 +371,22 @@ time_t timegm(struct tm * const t) register time_t i; register time_t years = (time_t)t->tm_year - 70; - if (t->tm_sec > 60) + if (t->tm_sec > 60) /* seconds after the minute - [0, 60] including leap second */ { t->tm_min += t->tm_sec / 60; t->tm_sec %= 60; } - if (t->tm_min > 60) + if (t->tm_min >= 60) /* minutes after the hour - [0, 59] */ { t->tm_hour += t->tm_min / 60; t->tm_min %= 60; } - if (t->tm_hour > 24) + if (t->tm_hour >= 24) /* hours since midnight - [0, 23] */ { t->tm_mday += t->tm_hour / 24; t->tm_hour %= 24; } - if (t->tm_mon > 12) + if (t->tm_mon >= 12) /* months since January - [0, 11] */ { t->tm_year += t->tm_mon / 12; t->tm_mon %= 12; @@ -503,7 +503,7 @@ RTM_EXPORT(nanosleep); #ifdef RT_USING_POSIX_CLOCK #ifdef RT_USING_RTC static volatile struct timeval _timevalue; -static int _rt_clock_time_system_init() +static int _rt_clock_time_system_init(void) { register rt_base_t level; time_t time = 0; |
