mirror of https://github.com/Icinga/icinga2.git
parent
1246d7dda3
commit
ed27130402
|
@ -150,6 +150,7 @@ void LegacyTimePeriod::ParseTimeSpec(const String& timespec, tm *begin, tm *end,
|
||||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid day in time specification: " + timespec));
|
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid day in time specification: " + timespec));
|
||||||
|
|
||||||
if (begin) {
|
if (begin) {
|
||||||
|
*begin = *reference;
|
||||||
begin->tm_year = year - 1900;
|
begin->tm_year = year - 1900;
|
||||||
begin->tm_mon = month - 1;
|
begin->tm_mon = month - 1;
|
||||||
begin->tm_mday = day;
|
begin->tm_mday = day;
|
||||||
|
@ -159,6 +160,7 @@ void LegacyTimePeriod::ParseTimeSpec(const String& timespec, tm *begin, tm *end,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end) {
|
if (end) {
|
||||||
|
*end = *reference;
|
||||||
end->tm_year = year - 1900;
|
end->tm_year = year - 1900;
|
||||||
end->tm_mon = month - 1;
|
end->tm_mon = month - 1;
|
||||||
end->tm_mday = day;
|
end->tm_mday = day;
|
||||||
|
@ -191,7 +193,7 @@ void LegacyTimePeriod::ParseTimeSpec(const String& timespec, tm *begin, tm *end,
|
||||||
|
|
||||||
/* Negative days are relative to the next month. */
|
/* Negative days are relative to the next month. */
|
||||||
if (mday < 0) {
|
if (mday < 0) {
|
||||||
end->tm_mday--;
|
begin->tm_mday = mday * -1 - 1;
|
||||||
begin->tm_mon++;
|
begin->tm_mon++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,7 +208,7 @@ void LegacyTimePeriod::ParseTimeSpec(const String& timespec, tm *begin, tm *end,
|
||||||
|
|
||||||
/* Negative days are relative to the next month. */
|
/* Negative days are relative to the next month. */
|
||||||
if (mday < 0) {
|
if (mday < 0) {
|
||||||
end->tm_mday--;
|
end->tm_mday = mday * -1 - 1;
|
||||||
end->tm_mon++;
|
end->tm_mon++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue