Added TimeRange.getMiddle()

This commit is contained in:
Daniel Wolf 2016-12-29 20:45:32 +01:00
parent 9c9d79c54d
commit 4dc9d4253e
2 changed files with 5 additions and 0 deletions

View File

@ -31,6 +31,10 @@ time_type TimeRange::getDuration() const {
return end - start; return end - start;
} }
time_type TimeRange::getMiddle() const {
return (start + end) / 2;
}
bool TimeRange::empty() const { bool TimeRange::empty() const {
return start == end; return start == end;
} }

View File

@ -17,6 +17,7 @@ public:
time_type getStart() const; time_type getStart() const;
time_type getEnd() const; time_type getEnd() const;
time_type getDuration() const; time_type getDuration() const;
time_type getMiddle() const;
bool empty() const; bool empty() const;
void setStart(time_type newStart); void setStart(time_type newStart);