]> granicus.if.org Git - libevent/commitdiff
Always round up when there's a fractional number of msecs.
authorChristopher Davis <chrisd@mangrin.org>
Sat, 10 Apr 2010 02:16:09 +0000 (19:16 -0700)
committerChristopher Davis <chrisd@mangrin.org>
Sat, 10 Apr 2010 02:16:09 +0000 (19:16 -0700)
evutil.c

index 3ca9fef9fb77caeab2b30e0227e602c4ac6c904f..b75a4697178b1c2d259bb2e8adfba5ee967a4648 100644 (file)
--- a/evutil.c
+++ b/evutil.c
@@ -1904,6 +1904,6 @@ evutil_tv_to_msec(const struct timeval *tv)
        if (tv->tv_usec > 1000000 || tv->tv_sec > MAX_SECONDS_IN_MSEC_LONG)
                return -1;
 
-       return (tv->tv_sec * 1000) + (tv->tv_usec / 1000);
+       return (tv->tv_sec * 1000) + ((tv->tv_usec + 999) / 1000);
 }