Fix travis compile error

This commit is contained in:
Tatsuhiro Tsujikawa 2015-06-30 00:01:26 +09:00
parent 51ef646678
commit dc7232fa53
2 changed files with 8 additions and 4 deletions

View File

@ -556,6 +556,8 @@ fi
# adjustment.
AC_CHECK_SIZEOF([int *])
AC_CHECK_SIZEOF([time_t])
# Checks for library functions.
if test "x$cross_compiling" != "xyes"; then
AC_FUNC_MALLOC

View File

@ -44,10 +44,12 @@ time_t timegm(struct tm *tm) {
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;
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) {
return -1;
}
}
#endif /* SIZEOF_TIME_T == 4 */
return (time_t)t;
}