[BUG] fix null timeouts in *poll-based pollers

Introduction of timeval timers broke *poll-based pollers, because the call to
tv_ms_remain may return 0 while the event is not elapsed yet. Now we carefully
check for those cases and round the result up by 1 ms.
diff --git a/src/ev_epoll.c b/src/ev_epoll.c
index a867e8d..d313d56 100644
--- a/src/ev_epoll.c
+++ b/src/ev_epoll.c
@@ -231,10 +231,12 @@
 		fd_flush_changes();
 
 	/* now let's wait for events */
-	if (tv_isset(exp))
-		wait_time = tv_ms_remain(&now, exp);
-	else
+	if (tv_iseternity(exp))
 		wait_time = -1;
+	else if (tv_isge(&now, exp))
+		wait_time = 0;
+	else
+		wait_time = __tv_ms_elapsed(&now, exp) + 1;
 
 	status = epoll_wait(epoll_fd, epoll_events, maxfd, wait_time);
 	tv_now(&now);
diff --git a/src/ev_poll.c b/src/ev_poll.c
index 3c97707..0166bd6 100644
--- a/src/ev_poll.c
+++ b/src/ev_poll.c
@@ -124,10 +124,12 @@
 	}
       
 	/* now let's wait for events */
-	if (tv_isset(exp))
-		wait_time = tv_ms_remain(&now, exp);
-	else
+	if (tv_iseternity(exp))
 		wait_time = -1;
+	else if (tv_isge(&now, exp))
+		wait_time = 0;
+	else
+		wait_time = __tv_ms_elapsed(&now, exp) + 1;
 
 	status = poll(poll_events, nbfd, wait_time);
 	tv_now(&now);
diff --git a/src/ev_sepoll.c b/src/ev_sepoll.c
index 516c0f5..3e25866 100644
--- a/src/ev_sepoll.c
+++ b/src/ev_sepoll.c
@@ -380,10 +380,12 @@
 		wait_time = 0;
 	}
 	else {
-		if (tv_isset(exp))
-			wait_time = tv_ms_remain(&now, exp);
-		else
+		if (tv_iseternity(exp))
 			wait_time = -1;
+		else if (tv_isge(&now, exp))
+			wait_time = 0;
+		else
+			wait_time = __tv_ms_elapsed(&now, exp) + 1;
 	}
 
 	/* now let's wait for real events */