From: fbachmann Date: Tue, 10 Apr 2018 18:16:09 +0000 (+0200) Subject: fix bug in Downtime::IsInEffect() method that would always return false if the trigge... X-Git-Tag: v2.9.0~96^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f75ccbe75f2c654229950a3e5bc2b00c20ece73;p=icinga2 fix bug in Downtime::IsInEffect() method that would always return false if the triggering window for a flexible downtime had passed --- diff --git a/lib/icinga/downtime.cpp b/lib/icinga/downtime.cpp index a52358359..4fe9a0085 100644 --- a/lib/icinga/downtime.cpp +++ b/lib/icinga/downtime.cpp @@ -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());