Fix validator for TimePeriod ranges

fixes #8568
This commit is contained in:
Gunnar Beutner 2015-03-03 09:56:38 +01:00
parent cf37decbef
commit 1d2b008dcb
1 changed files with 5 additions and 5 deletions

View File

@ -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()));