diff --git a/src/time/TimeRange.cpp b/src/time/TimeRange.cpp index 80daa72..35d6293 100644 --- a/src/time/TimeRange.cpp +++ b/src/time/TimeRange.cpp @@ -31,6 +31,10 @@ time_type TimeRange::getDuration() const { return end - start; } +time_type TimeRange::getMiddle() const { + return (start + end) / 2; +} + bool TimeRange::empty() const { return start == end; } diff --git a/src/time/TimeRange.h b/src/time/TimeRange.h index f1524d1..e0082b1 100644 --- a/src/time/TimeRange.h +++ b/src/time/TimeRange.h @@ -17,6 +17,7 @@ public: time_type getStart() const; time_type getEnd() const; time_type getDuration() const; + time_type getMiddle() const; bool empty() const; void setStart(time_type newStart);