Fix travis compile error
This commit is contained in:
parent
51ef646678
commit
dc7232fa53
|
@ -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
|
||||
|
|
10
src/timegm.c
10
src/timegm.c
|
@ -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 (t < INT32_MIN || t > INT32_MAX) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if SIZEOF_TIME_T == 4
|
||||
if (t < INT32_MIN || t > INT32_MAX) {
|
||||
return -1;
|
||||
}
|
||||
#endif /* SIZEOF_TIME_T == 4 */
|
||||
|
||||
return (time_t)t;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue