From: Mark Andrews Date: Fri, 29 Aug 2008 03:57:38 +0000 (+0000) Subject: 2430. [bug] win32: isc_interval_set() could round down to X-Git-Tag: v9.6.0a1~106 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=e72c1e7e465822fc9b5067b2dd3cf047f6132214;p=thirdparty%2Fbind9.git 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] --- diff --git a/CHANGES b/CHANGES index 38fa2414ec5..eafe6370a53 100644 --- 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] diff --git a/lib/isc/win32/time.c b/lib/isc/win32/time.c index d2ef982b692..2522954f06b 100644 --- a/lib/isc/win32/time.c +++ b/lib/isc/win32/time.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: time.c,v 1.43 2007/06/19 23:47:19 tbox Exp $ */ +/* $Id: time.c,v 1.44 2008/08/29 03:57:38 marka Exp $ */ #include @@ -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