Merge pull request #6311 from Reamer/timeperiod_bugfix

refs #6282
This commit is contained in:
Noah Hilverling 2018-06-19 10:29:27 +02:00 committed by GitHub
commit 233d00d648
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -142,12 +142,12 @@ void TimePeriod::RemoveSegment(double begin, double end)
for (const Dictionary::Ptr& segment : segments) {
/* Fully contained in the specified range? */
if (segment->Get("begin") >= begin && segment->Get("end") <= end)
// Don't add the old segment, because the segment is fully contained into our range
continue;
/* Not overlapping at all? */
if (segment->Get("end") < begin || segment->Get("begin") > end) {
newSegments->Add(segment);
continue;
}
@ -162,6 +162,8 @@ void TimePeriod::RemoveSegment(double begin, double end)
{ "begin", end },
{ "end", segment->Get("end") }
}));
// Don't add the old segment, because we have now two new segments and a gap between
continue;
}
/* Adjust the begin/end timestamps so as to not overlap with the specified range. */