mirror of https://github.com/Icinga/icinga2.git
parent
cf37decbef
commit
1d2b008dcb
|
@ -314,16 +314,16 @@ void TimePeriod::ValidateRanges(const String& location, const TimePeriod::Ptr& o
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* create a fake time environment to validate the definitions */
|
/* create a fake time environment to validate the definitions */
|
||||||
time_t begin = Utility::GetTime();
|
time_t refts = Utility::GetTime();
|
||||||
time_t end = begin + 24 * 60 * 60;
|
tm reference = Utility::LocalTime(refts);
|
||||||
tm reference = Utility::LocalTime(end);
|
|
||||||
tm begin_tm, end_tm;
|
|
||||||
Array::Ptr segments = new Array();
|
Array::Ptr segments = new Array();
|
||||||
|
|
||||||
ObjectLock olock(ranges);
|
ObjectLock olock(ranges);
|
||||||
BOOST_FOREACH(const Dictionary::Pair& kv, ranges) {
|
BOOST_FOREACH(const Dictionary::Pair& kv, ranges) {
|
||||||
try {
|
try {
|
||||||
LegacyTimePeriod::ParseTimeSpec(kv.first, &begin_tm, &end_tm, &reference);
|
tm begin_tm, end_tm;
|
||||||
|
int stride;
|
||||||
|
LegacyTimePeriod::ParseTimeRange(kv.first, &begin_tm, &end_tm, &stride, &reference);
|
||||||
} catch (std::exception&) {
|
} catch (std::exception&) {
|
||||||
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
BOOST_THROW_EXCEPTION(ScriptError("Validation failed for " +
|
||||||
location + ": Invalid time specification.", object->GetDebugInfo()));
|
location + ": Invalid time specification.", object->GetDebugInfo()));
|
||||||
|
|
Loading…
Reference in New Issue