71. [cleanup] Made explicit the implicit REQUIREs of
isc_time_seconds, isc_time_nanoseconds, and
isc_time_subtract.
70. [func] isc_time_set() added.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
71. [cleanup] Made explicit the implicit REQUIREs of
|
||||
isc_time_seconds, isc_time_nanoseconds, and
|
||||
isc_time_subtract.
|
||||
|
||||
70. [func] isc_time_set() added.
|
||||
|
||||
69. [bug] The zone object's master and also-notify lists grew
|
||||
longer with each server reload.
|
||||
@@ -17,11 +22,11 @@
|
||||
caller find the most-enclosing superdomain of
|
||||
a name.
|
||||
|
||||
63 [func] generate NOTIFY messages.
|
||||
63 [func] Generate NOTIFY messages.
|
||||
|
||||
62. [func] add UDP refresh support.
|
||||
62. [func] Add UDP refresh support.
|
||||
|
||||
61. [cleanup] use single quotes consistently in log messages.
|
||||
61. [cleanup] Use single quotes consistently in log messages.
|
||||
|
||||
60. [func] Catch and disallow singleton types on message
|
||||
parse.
|
||||
|
||||
@@ -77,6 +77,18 @@ isc_interval_iszero(isc_interval_t *i) {
|
||||
static isc_time_t epoch = { 0, 0 };
|
||||
isc_time_t *isc_time_epoch = &epoch;
|
||||
|
||||
void
|
||||
isc_time_set(isc_time_t *t, unsigned int seconds, unsigned int nanoseconds) {
|
||||
/*
|
||||
* Set 't' to a particular number of seconds + nanoseconds since the
|
||||
* epoch.
|
||||
*/
|
||||
REQUIRE(t != NULL);
|
||||
|
||||
t->seconds = seconds;
|
||||
t->nanoseconds = nanoseconds;
|
||||
}
|
||||
|
||||
void
|
||||
isc_time_settoepoch(isc_time_t *t) {
|
||||
/*
|
||||
@@ -195,6 +207,9 @@ isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result) {
|
||||
*/
|
||||
|
||||
REQUIRE(t != NULL && i != NULL && result != NULL);
|
||||
REQUIRE((unsigned int)t->seconds > i->seconds ||
|
||||
((unsigned int)t->seconds == i->seconds &&
|
||||
t->nanoseconds >= i->nanoseconds));
|
||||
|
||||
result->seconds = t->seconds - i->seconds;
|
||||
if (t->nanoseconds >= i->nanoseconds)
|
||||
@@ -230,11 +245,15 @@ isc_time_microdiff(isc_time_t *t1, isc_time_t *t2) {
|
||||
|
||||
isc_uint32_t
|
||||
isc_time_seconds(isc_time_t *t) {
|
||||
REQUIRE(t != NULL);
|
||||
|
||||
return ((isc_uint32_t)t->seconds);
|
||||
}
|
||||
|
||||
isc_uint32_t
|
||||
isc_time_nanoseconds(isc_time_t *t) {
|
||||
REQUIRE(t != NULL);
|
||||
|
||||
ENSURE(t->nanoseconds < 1000000000);
|
||||
|
||||
return ((isc_uint32_t)t->nanoseconds);
|
||||
|
||||
+36
-12
@@ -84,6 +84,25 @@ isc_interval_iszero(isc_interval_t *i) {
|
||||
static isc_time_t epoch = { 0, 0 };
|
||||
isc_time_t *isc_time_epoch = &epoch;
|
||||
|
||||
void
|
||||
isc_time_set(isc_time_t *t, unsigned int seconds, unsigned int nanoseconds) {
|
||||
ULARGE_INTEGER i;
|
||||
|
||||
/*
|
||||
* Set 't' to a particular number of seconds + nanoseconds since the
|
||||
* epoch.
|
||||
*/
|
||||
REQUIRE(t != NULL);
|
||||
REQUIRE(nanoseconds < 1000000000);
|
||||
|
||||
i.QuadPart = (LONGLONG)seconds * INTERVALS_PER_S
|
||||
+ nanoseconds / NS_INTERVAL;
|
||||
|
||||
t->absolute.dwLowDateTime = i.LowPart;
|
||||
t->absolute.dwHighDateTime = i.HighPart;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
isc_time_settoepoch(isc_time_t *t) {
|
||||
/*
|
||||
@@ -160,9 +179,8 @@ isc_time_compare(isc_time_t *t1, isc_time_t *t2) {
|
||||
}
|
||||
|
||||
void
|
||||
isc_time_add(isc_time_t *t, isc_interval_t *i, isc_time_t *result)
|
||||
{
|
||||
ULARGE_INTEGER i1, i2;
|
||||
isc_time_add(isc_time_t *t, isc_interval_t *i, isc_time_t *result) {
|
||||
ULARGE_INTEGER i1;
|
||||
|
||||
/*
|
||||
* Add 't' to 'i', storing the result in 'result'.
|
||||
@@ -173,15 +191,15 @@ isc_time_add(isc_time_t *t, isc_interval_t *i, isc_time_t *result)
|
||||
i1.LowPart = t->absolute.dwLowDateTime;
|
||||
i1.HighPart = t->absolute.dwHighDateTime;
|
||||
|
||||
i2.QuadPart = i1.QuadPart + i->interval;
|
||||
|
||||
result->absolute.dwLowDateTime = i2.LowPart;
|
||||
result->absolute.dwHighDateTime = i2.HighPart;
|
||||
i1.QuadPart += i->interval;
|
||||
|
||||
result->absolute.dwLowDateTime = i1.LowPart;
|
||||
result->absolute.dwHighDateTime = i1.HighPart;
|
||||
}
|
||||
|
||||
void
|
||||
isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result) {
|
||||
ULARGE_INTEGER i1, i2;
|
||||
ULARGE_INTEGER i1;
|
||||
|
||||
/*
|
||||
* Subtract 'i' from 't', storing the result in 'result'.
|
||||
@@ -192,10 +210,12 @@ isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result) {
|
||||
i1.LowPart = t->absolute.dwLowDateTime;
|
||||
i1.HighPart = t->absolute.dwHighDateTime;
|
||||
|
||||
i2.QuadPart = i1.QuadPart - i->interval;
|
||||
|
||||
result->absolute.dwLowDateTime = i2.LowPart;
|
||||
result->absolute.dwHighDateTime = i2.HighPart;
|
||||
REQUIRE(i1.QuadPart >= i->interval);
|
||||
|
||||
i1.QuadPart -= i->interval;
|
||||
|
||||
result->absolute.dwLowDateTime = i1.LowPart;
|
||||
result->absolute.dwHighDateTime = i1.HighPart;
|
||||
}
|
||||
|
||||
isc_uint64_t
|
||||
@@ -225,6 +245,8 @@ isc_uint32_t
|
||||
isc_time_seconds(isc_time_t *t) {
|
||||
ULARGE_INTEGER i;
|
||||
|
||||
REQUIRE(t != NULL);
|
||||
|
||||
i.LowPart = t->absolute.dwLowDateTime;
|
||||
i.HighPart = t->absolute.dwHighDateTime;
|
||||
|
||||
@@ -237,6 +259,8 @@ isc_uint32_t
|
||||
isc_time_nanoseconds(isc_time_t *t) {
|
||||
ULARGE_INTEGER i;
|
||||
|
||||
REQUIRE(t != NULL);
|
||||
|
||||
i.LowPart = t->absolute.dwLowDateTime;
|
||||
i.HighPart = t->absolute.dwHighDateTime;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user