From 50394e8dd2618349f54bf758b601448b8234417c Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 29 May 2018 07:23:26 -0400 Subject: [PATCH] TT#37156 fix divide by zero error (regression from db58aa80) fixes #564 Change-Id: Ifdc58c814d6a0c82d95ca86ab2fd4eb3a85486ae --- daemon/statistics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/statistics.c b/daemon/statistics.c index b17223107..0f50e2a18 100644 --- a/daemon/statistics.c +++ b/daemon/statistics.c @@ -45,7 +45,7 @@ static void timeval_totalstats_interval_call_duration_add(struct totalstats *s, struct timeval *call_start_in_iv = call_start; /* in case graphite interval needs to be the previous one */ - if (timercmp(&real_iv_start, call_stop, >)) { + if (timercmp(&real_iv_start, call_stop, >) && interval_dur_s) { // round up to nearest while interval_dur_s long long d = timeval_diff(&real_iv_start, call_stop); d += (interval_dur_s * 1000000) - 1;