+ /** start time of sampling interval that the period is from */
+ T from;
+ /** start time of next sampling interval after the period */
+ T to;
+
+ T duration () const {
+ return to - from;
+ }
+
+ TimePeriod<T> operator+ (T const & o) const {
+ return TimePeriod<T> (from + o, to + o);
+ }
+
+ boost::optional<TimePeriod<T> > overlap (TimePeriod<T> const & other) {
+ T const max_from = std::max (from, other.from);
+ T const min_to = std::min (to, other.to);
+
+ if (max_from >= min_to) {
+ return boost::optional<TimePeriod<T> > ();
+ }