if test $now -lt `expr $value + $lee`; then
return
fi
- #@@@ DEBUG
- return
fi
$ctrl -c $conf stats > $state
if test $? -ne 0; then
/** 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;
/** 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;
+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.
/** 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;
/** 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;
/** 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;
/** 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)