]> granicus.if.org Git - icinga2/commitdiff
Make sure the check latency can't be negative.
authorGunnar Beutner <gunnar.beutner@netways.de>
Thu, 12 Sep 2013 09:36:31 +0000 (11:36 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Thu, 12 Sep 2013 09:36:31 +0000 (11:36 +0200)
lib/icinga/service-check.cpp

index 0f4a172dfe8fa1ad6374864c08b6a131d4dc4597..2db17516920b68106cad67d9e11c4937ff6c9e18 100644 (file)
@@ -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;
 }