X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcpomatic_time.cc;h=812c756ec27891224495b1a57b3e374ee793321d;hb=ed60129bb2051649de3740ff75a7db71db9e7897;hp=5344915c0c71c31639629ad58995ff6a3a96c25d;hpb=79ce26d031d109177ba4b0f637fa2960345a37a3;p=dcpomatic.git diff --git a/src/lib/dcpomatic_time.cc b/src/lib/dcpomatic_time.cc index 5344915c0..812c756ec 100644 --- a/src/lib/dcpomatic_time.cc +++ b/src/lib/dcpomatic_time.cc @@ -19,6 +19,8 @@ #include "dcpomatic_time.h" +using std::ostream; + ContentTime::ContentTime (DCPTime d, FrameRateChange f) : Time (rint (d.get() * f.speed_up)) { @@ -33,3 +35,29 @@ DCPTime min (DCPTime a, DCPTime b) return b; } + +ostream & +operator<< (ostream& s, ContentTime t) +{ + s << "[CONT " << t.get() << " " << t.seconds() << "s]"; + return s; +} + +ostream & +operator<< (ostream& s, DCPTime t) +{ + s << "[DCP " << t.get() << " " << t.seconds() << "s]"; + return s; +} + +bool +ContentTimePeriod::overlaps (ContentTimePeriod const & other) const +{ + return (from < other.to && to >= other.from); +} + +bool +ContentTimePeriod::contains (ContentTime const & other) const +{ + return (from <= other && other < to); +}