提交 59100a72 编写于 作者: K kailixu

enh: code optimize for mktime

上级 b34451a1
...@@ -399,13 +399,12 @@ int64_t user_mktime64(const uint32_t year, const uint32_t mon, const uint32_t da ...@@ -399,13 +399,12 @@ int64_t user_mktime64(const uint32_t year, const uint32_t mon, const uint32_t da
// int64_t _res = (((((int64_t) (_year/4 - _year/100 + _year/400 + 367*_mon/12 + day) + // int64_t _res = (((((int64_t) (_year/4 - _year/100 + _year/400 + 367*_mon/12 + day) +
// _year*365 - 719499)*24 + hour)*60 + min)*60 + sec); // _year*365 - 719499)*24 + hour)*60 + min)*60 + sec);
int64_t _res; int64_t _res = 367 * ((int64_t)_mon) / 12;
_res = 367 * ((int64_t)_mon) / 12;
_res += _year / 4 - _year / 100 + _year / 400 + day + ((int64_t)_year) * 365 - 719499; _res += _year / 4 - _year / 100 + _year / 400 + day + ((int64_t)_year) * 365 - 719499;
_res = _res * 24; _res *= 24;
_res = ((_res + hour) * 60 + min) * 60 + sec; _res = ((_res + hour) * 60 + min) * 60 + sec;
return (_res + time_zone); return _res + time_zone;
} }
time_t taosMktime(struct tm *timep) { time_t taosMktime(struct tm *timep) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册