X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcpomatic_time.h;h=6834ee099616a94c273175fa8323378f8372fd14;hb=11ac33e140f3aa9d6e992880a1e1b3a4ca649355;hp=c13f2bbfe7a4e00e2b1b60e1ed218ede6e085d05;hpb=5a83297c4d78a8bc130cea5a05ef3a73cd0e39d8;p=dcpomatic.git diff --git a/src/lib/dcpomatic_time.h b/src/lib/dcpomatic_time.h index c13f2bbfe..6834ee099 100644 --- a/src/lib/dcpomatic_time.h +++ b/src/lib/dcpomatic_time.h @@ -118,7 +118,7 @@ public: * at some sampling rate. * @param r Sampling rate. */ - Time round_up (float r) const { + Time ceil (float r) const { Type const n = llrintf (HZ / r); Type const a = _t + n - 1; return Time (a - (a % n)); @@ -152,7 +152,7 @@ public: the calculation will round down before we get the chance to ceil(). */ - return ceil (_t * double(r) / HZ); + return ::ceil (_t * double(r) / HZ); } /** @param r Frames per second */ @@ -211,7 +211,7 @@ public: } private: - friend struct dcptime_round_up_test; + friend struct dcptime_ceil_test; Type _t; static const int HZ = 96000; @@ -272,9 +272,20 @@ public: return (from <= other && other < to); } + bool operator< (TimePeriod const & o) const { + if (from != o.from) { + return from < o.from; + } + return to < o.to; + } + bool operator== (TimePeriod const & other) const { return from == other.from && to == other.to; } + + bool operator!= (TimePeriod const & other) const { + return !(*this == other); + } }; typedef TimePeriod ContentTimePeriod;