"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/icinga/legacytimeperiod.cpp" between
icinga2-2.11.5.tar.gz and icinga2-2.12.0.tar.gz

About: Icinga 2 is an enterprise grade monitoring system which keeps watch over networks and any conceivable network resource.

legacytimeperiod.cpp  (icinga2-2.11.5):legacytimeperiod.cpp  (icinga2-2.12.0)
skipping to change at line 340 skipping to change at line 340
ParseTimeRange(daydef, &begin, &end, &stride, reference); ParseTimeRange(daydef, &begin, &end, &stride, reference);
Log(LogDebug, "LegacyTimePeriod") Log(LogDebug, "LegacyTimePeriod")
<< "ParseTimeRange: '" << daydef << "' => " << mktime(&begin) << "ParseTimeRange: '" << daydef << "' => " << mktime(&begin)
<< " -> " << mktime(&end) << ", stride: " << stride; << " -> " << mktime(&end) << ", stride: " << stride;
return IsInTimeRange(&begin, &end, stride, reference); return IsInTimeRange(&begin, &end, stride, reference);
} }
void LegacyTimePeriod::ProcessTimeRangeRaw(const String& timerange, tm *referenc static inline
e, tm *begin, tm *end) void ProcessTimeRaw(const String& in, tm *reference, tm *out)
{ {
std::vector<String> times = timerange.Split("-"); *out = *reference;
if (times.size() != 2)
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid timerange: "
+ timerange));
std::vector<String> hd1 = times[0].Split(":"); auto hd (in.Split(":"));
if (hd1.size() != 2) switch (hd.size()) {
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid time specifi case 2:
cation: " + times[0])); out->tm_sec = 0;
break;
case 3:
out->tm_sec = Convert::ToLong(hd[2]);
break;
default:
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid time
specification: " + in));
}
std::vector<String> hd2 = times[1].Split(":"); out->tm_hour = Convert::ToLong(hd[0]);
out->tm_min = Convert::ToLong(hd[1]);
}
if (hd2.size() != 2) void LegacyTimePeriod::ProcessTimeRangeRaw(const String& timerange, tm *referenc
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid time specifi e, tm *begin, tm *end)
cation: " + times[1])); {
std::vector<String> times = timerange.Split("-");
*begin = *reference; if (times.size() != 2)
begin->tm_sec = 0; BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid timerange: "
begin->tm_min = Convert::ToLong(hd1[1]); + timerange));
begin->tm_hour = Convert::ToLong(hd1[0]);
*end = *reference; ProcessTimeRaw(times[0], reference, begin);
end->tm_sec = 0; ProcessTimeRaw(times[1], reference, end);
end->tm_min = Convert::ToLong(hd2[1]);
end->tm_hour = Convert::ToLong(hd2[0]);
if (begin->tm_hour * 3600 + begin->tm_min * 60 + begin->tm_sec >= if (begin->tm_hour * 3600 + begin->tm_min * 60 + begin->tm_sec >=
end->tm_hour * 3600 + end->tm_min * 60 + end->tm_sec) end->tm_hour * 3600 + end->tm_min * 60 + end->tm_sec)
end->tm_hour += 24; end->tm_hour += 24;
} }
Dictionary::Ptr LegacyTimePeriod::ProcessTimeRange(const String& timestamp, tm * reference) Dictionary::Ptr LegacyTimePeriod::ProcessTimeRange(const String& timestamp, tm * reference)
{ {
tm begin, end; tm begin, end;
 End of changes. 8 change blocks. 
23 lines changed or deleted 27 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)