]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2430. [bug] win32: isc_interval_set() could round down to
authorMark Andrews <marka@isc.org>
Fri, 29 Aug 2008 04:05:30 +0000 (04:05 +0000)
committerMark Andrews <marka@isc.org>
Fri, 29 Aug 2008 04:05:30 +0000 (04:05 +0000)
                        zero if the input was less than NS_INTERVAL
                        nanoseconds.  Round up instead. [RT #18549]

CHANGES
lib/isc/win32/time.c

diff --git a/CHANGES b/CHANGES
index 7a1223e5254d9e184ed92d1d80f4f0ac57dcccef..edefddcb1c22aaa82e92b674369a60a849a92257 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+2430.  [bug]           win32: isc_interval_set() could round down to
+                       zero if the input was less than NS_INTERVAL
+                       nanoseconds.  Round up instead. [RT #18549]
+
 2429.  [doc]           nsupdate should be in section 1 of the man pages.
                        [RT #18283]
 
index cc396b7852eff6172efd3ba9a3c429c38843038f..37cd20e5ea8f09a21948c83bf96b0d971127d0ab 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: time.c,v 1.24.2.3.10.4 2004/03/11 05:58:42 marka Exp $ */
+/* $Id: time.c,v 1.24.2.3.10.5 2008/08/29 04:05:30 marka Exp $ */
 
 #include <config.h>
 
@@ -64,8 +64,11 @@ isc_interval_set(isc_interval_t *i, unsigned int seconds,
        REQUIRE(i != NULL);
        REQUIRE(nanoseconds < NS_PER_S);
 
+       /*
+        * This rounds nanoseconds up not down.
+        */
        i->interval = (LONGLONG)seconds * INTERVALS_PER_S
-               + nanoseconds / NS_INTERVAL;
+               + (nanoseconds + NS_INTERVAL - 1) / NS_INTERVAL;
 }
 
 isc_boolean_t