]> granicus.if.org Git - icinga2/commitdiff
fix bug in Downtime::IsInEffect() method that would always return false if the trigge... 6218/head
authorfbachmann <bachmann.f@gmail.com>
Tue, 10 Apr 2018 18:16:09 +0000 (20:16 +0200)
committerfbachmann <bachmann.f@gmail.com>
Tue, 10 Apr 2018 18:16:09 +0000 (20:16 +0200)
lib/icinga/downtime.cpp

index a52358359128ce271cb652b4449f119e30f534f0..4fe9a0085eab177232421999fa4ff69f5713f8f6 100644 (file)
@@ -158,16 +158,15 @@ bool Downtime::IsInEffect() const
 {
        double now = Utility::GetTime();
 
-       if (now < GetStartTime() ||
-               now > GetEndTime())
-               return false;
-
-       if (GetFixed())
-               return true;
+       if (GetFixed()) {
+               /* fixed downtimes are in effect during the entire [start..end) interval */
+               return (now >= GetStartTime() && now < GetEndTime());
+       }
 
        double triggerTime = GetTriggerTime();
 
        if (triggerTime == 0)
+               /* flexible downtime has not been triggered yet */
                return false;
 
        return (now < triggerTime + GetDuration());