Fixing timeval calculation
authorSimo Sorce <ssorce@redhat.com>
Fri, 25 Sep 2009 14:59:04 +0000 (10:59 -0400)
committerSimo Sorce <ssorce@redhat.com>
Fri, 25 Sep 2009 15:00:19 +0000 (11:00 -0400)
The code was always doubling microseconds when attempting to round up.

lib/tevent/tevent_timed.c

index d75653d847bbbc67528856bc664acff38dbad102..cc51bf60d5977fbd13c5cbf616cb98a02a9edcdd 100644 (file)
@@ -114,7 +114,7 @@ struct timeval tevent_timeval_add(const struct timeval *tv, uint32_t secs,
        tv2.tv_sec += secs;
        tv2.tv_usec += usecs;
        tv2.tv_sec += tv2.tv_usec / 1000000;
-       tv2.tv_usec += tv2.tv_usec % 1000000;
+       tv2.tv_usec = tv2.tv_usec % 1000000;
 
        return tv2;
 }