Skip to content

Commit d71935a

Browse files
committed
fix tv_usec type
1 parent 9bc9932 commit d71935a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

ext/openssl/ossl_ssl.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@
2424
# define TO_SOCKET(s) (s)
2525
#endif
2626

27+
#ifndef TYPEOF_TIMEVAL_TV_USEC
28+
# if INT_MAX >= 1000000
29+
# define TYPEOF_TIMEVAL_TV_USEC int
30+
# else
31+
# define TYPEOF_TIMEVAL_TV_USEC long
32+
# endif
33+
#endif
34+
2735
#define GetSSLCTX(obj, ctx) do { \
2836
TypedData_Get_Struct((obj), SSL_CTX, &ossl_sslctx_type, (ctx)); \
2937
} while (0)
@@ -3256,7 +3264,7 @@ ossl_ssl_poll(int argc, VALUE *argv, VALUE klass)
32563264
} else {
32573265
double t = NUM2DBL(timeout_v);
32583266
tv.tv_sec = (time_t)t;
3259-
tv.tv_usec = (suseconds_t)((t - (double)tv.tv_sec) * 1000000.0);
3267+
tv.tv_usec = (TYPEOF_TIMEVAL_TV_USEC)((t - (double)tv.tv_sec) * 1000000.0);
32603268
has_timeout = 1;
32613269
}
32623270

0 commit comments

Comments
 (0)