]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Fixup error in time calculation.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 18 Sep 2008 07:55:01 +0000 (07:55 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 18 Sep 2008 07:55:01 +0000 (07:55 +0000)
git-svn-id: file:///svn/unbound/trunk@1247 be551aaa-1e26-0410-a405-d3ace91eadb9

contrib/unbound_munin_
daemon/remote.c
daemon/stats.c
doc/Changelog
services/mesh.c
testcode/fake_event.c
util/timehist.c

index c30df47805ed96d5dd93d33148893bbf3fdb9c69..8ea7a7646be4428ddbbfd251ce9cf1ac550ca8fb 100755 (executable)
@@ -125,8 +125,6 @@ get_state ( ) {
                if test $now -lt `expr $value + $lee`; then
                        return
                fi
-               #@@@ DEBUG
-               return
        fi
        $ctrl -c $conf stats > $state
        if test $? -ne 0; then
index adde3fec2d229010ae5c2018ef4afbfb16a6bba0..3c9ac1f19218c00c224cc922736bd88de5815dbd 100644 (file)
@@ -91,21 +91,23 @@ log_crypto_err(const char* str)
 
 /** subtract timers and the values do not overflow or become negative */
 static void
-timeval_subtract(struct timeval* d, struct timeval* end, struct timeval* start)
+timeval_subtract(struct timeval* d, const struct timeval* end, 
+       const struct timeval* start)
 {
 #ifndef S_SPLINT_S
+       time_t end_usec = end->tv_usec;;
        d->tv_sec = end->tv_sec - start->tv_sec;
-       while(end->tv_usec < start->tv_usec) {
-               end->tv_usec += 1000000;
+       while(end_usec < start->tv_usec) {
+               end_usec += 1000000;
                d->tv_sec--;
        }
-       d->tv_usec = end->tv_usec - start->tv_usec;
+       d->tv_usec = end_usec - start->tv_usec;
 #endif
 }
 
 /** divide sum of timers to get average */
 static void
-timeval_divide(struct timeval* avg, struct timeval* sum, size_t d)
+timeval_divide(struct timeval* avg, const struct timeval* sum, size_t d)
 {
 #ifndef S_SPLINT_S
        size_t leftover;
index 89f9e5fd8d95a3baac3c5a307942183dbcc3b46b..2476212992b9c4da1472bf93e90a5caa1a15b52f 100644 (file)
@@ -53,7 +53,7 @@
 
 /** add timers and the values do not overflow or become negative */
 static void
-timeval_add(struct timeval* d, struct timeval* add)
+timeval_add(struct timeval* d, const struct timeval* add)
 {
 #ifndef S_SPLINT_S
        d->tv_sec += add->tv_sec;
index 6f665d4a8389a412145d94114db9252b3c12179a..1357ef70b656aa251f0cd817f3fe26813e4e4132 100644 (file)
@@ -1,3 +1,6 @@
+18 September 2008: Wouter
+       - fixup error in time calculation.
+
 17 September 2008: Wouter
        - locking for threadsafe bogus rrset counter.
        - ldns trunk no longer exports b32 functions, provide compat.
index c50bae7fe8949e0b9a66ca87971ebf4d89df3a6b..1ec60cfd7f663e02750055330529d6f1079fa30f 100644 (file)
 
 /** subtract timers and the values do not overflow or become negative */
 static void
-timeval_subtract(struct timeval* d, struct timeval* end, struct timeval* start)
+timeval_subtract(struct timeval* d, const struct timeval* end, const struct timeval* start)
 {
 #ifndef S_SPLINT_S
+       time_t end_usec = end->tv_usec;;
        d->tv_sec = end->tv_sec - start->tv_sec;
-       while(end->tv_usec < start->tv_usec) {
-               end->tv_usec += 1000000;
+       while(end_usec < start->tv_usec) {
+               end_usec += 1000000;
                d->tv_sec--;
        }
-       d->tv_usec = end->tv_usec - start->tv_usec;
+       d->tv_usec = end_usec - start->tv_usec;
 #endif
 }
 
 /** add timers and the values do not overflow or become negative */
 static void
-timeval_add(struct timeval* d, struct timeval* add)
+timeval_add(struct timeval* d, const struct timeval* add)
 {
 #ifndef S_SPLINT_S
        d->tv_sec += add->tv_sec;
@@ -86,7 +87,7 @@ timeval_add(struct timeval* d, struct timeval* add)
 
 /** divide sum of timers to get average */
 static void
-timeval_divide(struct timeval* avg, struct timeval* sum, size_t d)
+timeval_divide(struct timeval* avg, const struct timeval* sum, size_t d)
 {
 #ifndef S_SPLINT_S
        size_t leftover;
index d6afae9d5aeac774079d5e4c7114f7d5ef56d5bd..9518c0662bfbd36636fdc2075ad9ddeaa17f576e 100644 (file)
@@ -63,7 +63,7 @@ static struct replay_scenario* saved_scenario = NULL;
 
 /** add timers and the values do not overflow or become negative */
 static void
-timeval_add(struct timeval* d, struct timeval* add)
+timeval_add(struct timeval* d, const struct timeval* add)
 {
 #ifndef S_SPLINT_S
        d->tv_sec += add->tv_sec;
index 047f72e0287fa47e0933235fcd4fd1b4b1cf231f..6cdaf05edc0fbe6e7edd2c102b1de84cd205bad5 100644 (file)
@@ -111,7 +111,7 @@ void timehist_clear(struct timehist* hist)
 
 /** histogram compare of time values */
 static int
-timeval_smaller(struct timeval* x, struct timeval* y)
+timeval_smaller(const struct timeval* x, const struct timeval* y)
 {
 #ifndef S_SPLINT_S
        if(x->tv_sec < y->tv_sec)