diff --git a/src/backend.cmod b/src/backend.cmod index 126f3d0f74de43cb06c2a3ce1a779d2dcdc1c527..393b7106c489ae0b112d14e806722c23a1cceeca 100644 --- a/src/backend.cmod +++ b/src/backend.cmod @@ -3423,8 +3423,8 @@ static void noteEvents(CFFileDescriptorRef fdref, CFOptionFlags UNUSED(callBackT else if(next_timeout->tv_sec > (INT_MAX/1002)) /* about 24 days.*/ poll_timeout = INT_MAX/1002; else - poll_timeout = MAX((next_timeout->tv_sec*1000) + - next_timeout->tv_usec/1000,2); + poll_timeout = (next_timeout->tv_sec*1000) + + (next_timeout->tv_usec + 999)/1000; #elif defined(TIMEOUT_IS_TIMEVAL) poll_timeout = *next_timeout; #elif defined(TIMEOUT_IS_TIMESPEC) @@ -4112,7 +4112,7 @@ PIKECLASS PollBackend poll_timeout = INT_MAX; else poll_timeout = (next_timeout->tv_sec*1000) + - next_timeout->tv_usec/1000; + (next_timeout->tv_usec + 999)/1000; pb_copy_selectors(& pb->active_set, &pb->set);