提交 b9fcbfc3 编写于 作者: B bernard.xiong@gmail.com

fix timegm function issue.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@817 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 56916d1a
...@@ -80,11 +80,10 @@ time_t timegm(struct tm *const t) { ...@@ -80,11 +80,10 @@ time_t timegm(struct tm *const t) {
if (t->tm_sec>60) { t->tm_min += t->tm_sec/60; t->tm_sec%=60; } if (t->tm_sec>60) { t->tm_min += t->tm_sec/60; t->tm_sec%=60; }
if (t->tm_min>60) { t->tm_hour += t->tm_min/60; t->tm_min%=60; } if (t->tm_min>60) { t->tm_hour += t->tm_min/60; t->tm_min%=60; }
if (t->tm_hour>60) { t->tm_mday += t->tm_hour/60; t->tm_hour%=60; } if (t->tm_hour>24) { t->tm_mday += t->tm_hour/24; t->tm_hour%=24; }
if (t->tm_mon>12) { t->tm_year += t->tm_mon/12; t->tm_mon%=12; } if (t->tm_mon>12) { t->tm_year += t->tm_mon/12; t->tm_mon%=12; }
while (t->tm_mday>__spm[1+t->tm_mon]) { while (t->tm_mday>__spm[1+t->tm_mon]) {
if (t->tm_mon==1 && __isleap(t->tm_year+1900)) { if (t->tm_mon==1 && __isleap(t->tm_year+1900)) {
if (t->tm_mon==31+29) break;
--t->tm_mday; --t->tm_mday;
} }
t->tm_mday-=__spm[t->tm_mon]; t->tm_mday-=__spm[t->tm_mon];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册