Merge branch 'feature/timeperiod-fixes-5268' into next

Fixes #5268
This commit is contained in:
Gunnar Beutner 2013-12-05 12:31:44 +01:00
commit 5e95dd71be
2 changed files with 4 additions and 4 deletions

View File

@ -16,8 +16,8 @@ object TimePeriod "24x7" inherits "legacy-timeperiod" {
}
}
object TimePeriod "8x5" inherits "legacy-timeperiod" {
display_name = "Icinga 2 8x5 TimePeriod",
object TimePeriod "9to5" inherits "legacy-timeperiod" {
display_name = "Icinga 2 9to5 TimePeriod",
ranges = {
"monday" = "09:00-17:00",
"tuesday" = "09:00-17:00",

View File

@ -70,12 +70,12 @@ void TimePeriod::AddSegment(double begin, double end)
if (segment->Get("begin") <= begin && segment->Get("end") >= end)
return; /* New segment is fully contained in this segment. */
if (segment->Get("begin") < begin && segment->Get("end") > begin) {
if (segment->Get("begin") <= begin && segment->Get("end") >= begin) {
segment->Set("end", end); /* Extend an existing segment. */
return;
}
if (segment->Get("begin") > begin && segment->Get("begin") < end) {
if (segment->Get("begin") >= begin && segment->Get("begin") <= end) {
segment->Set("begin", begin); /* Extend an existing segment. */
return;
}