mirror of
https://github.com/Icinga/icinga2.git
synced 2025-05-29 02:40:20 +02:00
ido: Fix timeperiods with more than one segment.
This commit is contained in:
parent
a14e72c292
commit
cf3298f130
@ -97,18 +97,24 @@ void TimePeriodDbObject::OnConfigUpdate(void)
|
|||||||
}
|
}
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
tm begin, end;
|
Array::Ptr segments = boost::make_shared<Array>();
|
||||||
LegacyTimePeriod::ProcessTimeRangeRaw(value, &reference, &begin, &end);
|
LegacyTimePeriod::ProcessTimeRanges(value, &reference, segments);
|
||||||
|
|
||||||
DbQuery query;
|
BOOST_FOREACH(const Value& vsegment, segments) {
|
||||||
query.Table = GetType()->GetTable() + "_timeranges";
|
Dictionary::Ptr segment = vsegment;
|
||||||
query.Type = DbQueryInsert;
|
int begin = segment->Get("begin");
|
||||||
query.Fields = boost::make_shared<Dictionary>();
|
int end = segment->Get("end");
|
||||||
query.Fields->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
|
||||||
query.Fields->Set("timeperiod_id", DbValue::FromObjectInsertID(tp));
|
DbQuery query;
|
||||||
query.Fields->Set("day", wday);
|
query.Table = GetType()->GetTable() + "_timeranges";
|
||||||
query.Fields->Set("start_sec", begin.tm_hour * 3600 + begin.tm_min * 60 + begin.tm_sec);
|
query.Type = DbQueryInsert;
|
||||||
query.Fields->Set("end_sec", end.tm_hour * 3600 + end.tm_min * 60 + end.tm_sec);
|
query.Fields = boost::make_shared<Dictionary>();
|
||||||
OnQuery(query);
|
query.Fields->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||||
|
query.Fields->Set("timeperiod_id", DbValue::FromObjectInsertID(tp));
|
||||||
|
query.Fields->Set("day", wday);
|
||||||
|
query.Fields->Set("start_sec", begin % 86400);
|
||||||
|
query.Fields->Set("end_sec", end % 86400);
|
||||||
|
OnQuery(query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user