Commit dc7232fa authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Fix travis compile error

parent 51ef6466
...@@ -556,6 +556,8 @@ fi ...@@ -556,6 +556,8 @@ fi
# adjustment. # adjustment.
AC_CHECK_SIZEOF([int *]) AC_CHECK_SIZEOF([int *])
AC_CHECK_SIZEOF([time_t])
# Checks for library functions. # Checks for library functions.
if test "x$cross_compiling" != "xyes"; then if test "x$cross_compiling" != "xyes"; then
AC_FUNC_MALLOC AC_FUNC_MALLOC
......
...@@ -44,10 +44,12 @@ time_t timegm(struct tm *tm) { ...@@ -44,10 +44,12 @@ time_t timegm(struct tm *tm) {
num_leap_year = count_leap_year(tm->tm_year + 1900) - count_leap_year(1970); num_leap_year = count_leap_year(tm->tm_year + 1900) - count_leap_year(1970);
days = (tm->tm_year - 70) * 365 + num_leap_year + tm->tm_yday; days = (tm->tm_year - 70) * 365 + num_leap_year + tm->tm_yday;
t = ((int64_t)days * 24 + tm->tm_hour) * 3600 + tm->tm_min * 60 + tm->tm_sec; t = ((int64_t)days * 24 + tm->tm_hour) * 3600 + tm->tm_min * 60 + tm->tm_sec;
if (sizeof(time_t) == 4) {
#if SIZEOF_TIME_T == 4
if (t < INT32_MIN || t > INT32_MAX) { if (t < INT32_MIN || t > INT32_MAX) {
return -1; return -1;
} }
} #endif /* SIZEOF_TIME_T == 4 */
return (time_t)t; return (time_t)t;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment