diff --git a/thread.c b/thread.c index a7f29666a3..375a8a51f5 100644 --- a/thread.c +++ b/thread.c @@ -225,7 +225,7 @@ timeval_for(struct timeval *tv, const struct timespec *ts) { if (tv && ts) { tv->tv_sec = ts->tv_sec; - tv->tv_usec = ts->tv_nsec / 1000; + tv->tv_usec = (suseconds_t)(ts->tv_nsec / 1000); return tv; } return 0; diff --git a/thread_pthread.c b/thread_pthread.c index 08fd19627d..381114d1ce 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -365,13 +365,12 @@ native_cond_timedwait(rb_nativethread_cond_t *cond, pthread_mutex_t *mutex, cons static struct timespec native_cond_timeout(rb_nativethread_cond_t *cond, struct timespec timeout_rel) { - int ret; struct timespec timeout; struct timespec now; #if USE_MONOTONIC_COND if (cond->clockid == CLOCK_MONOTONIC) { - ret = clock_gettime(cond->clockid, &now); + int ret = clock_gettime(cond->clockid, &now); if (ret != 0) rb_sys_fail("clock_gettime()"); goto out;