From f418db79d76a2472ba29aec467c8b27e35704a51 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 12 Sep 2013 11:36:31 +0200 Subject: [PATCH] Make sure the check latency can't be negative. --- lib/icinga/service-check.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; } -- 2.40.0