From: Gunnar Beutner Date: Thu, 12 Sep 2013 09:36:31 +0000 (+0200) Subject: Make sure the check latency can't be negative. X-Git-Tag: v0.0.3~544 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f418db79d76a2472ba29aec467c8b27e35704a51;p=icinga2 Make sure the check latency can't be negative. --- diff --git a/lib/icinga/service-check.cpp b/lib/icinga/service-check.cpp index 0f4a172df..2db175169 100644 --- a/lib/icinga/service-check.cpp +++ b/lib/icinga/service-check.cpp @@ -837,5 +837,10 @@ double Service::CalculateLatency(const Dictionary::Ptr& cr) schedule_end = cr->Get("schedule_end"); } - return (schedule_end - schedule_start) - CalculateExecutionTime(cr); + double latency = (schedule_end - schedule_start) - CalculateExecutionTime(cr); + + if (latency < 0) + latency = 0; + + return latency; }