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]
This commit is contained in:
Mark Andrews 2008-08-29 03:57:38 +00:00
parent 3857cb6fca
commit e72c1e7e46
2 changed files with 9 additions and 2 deletions

View file

@ -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]

View file

@ -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 <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