X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcpomatic_time.h;h=a09dd93e9c179f515b08bfd093f8aaada36f2937;hb=94ee305348f7d3eb548fd44ca4aa1c57645056b1;hp=204af3c1eb4cc6df8fbae1c290f9b98577f1e2ab;hpb=0bb3c873e28552293e7132c93cdeeef65845596d;p=dcpomatic.git diff --git a/src/lib/dcpomatic_time.h b/src/lib/dcpomatic_time.h index 204af3c1e..a09dd93e9 100644 --- a/src/lib/dcpomatic_time.h +++ b/src/lib/dcpomatic_time.h @@ -113,6 +113,10 @@ public: return *this; } + Time operator/ (int o) const { + return Time (_t / o); + } + /** Round up to the nearest sampling interval * at some sampling rate. * @param r Sampling rate. @@ -125,6 +129,10 @@ public: return Time (llrint (HZ * frames_floor(r) / r)); } + Time round (double r) const { + return Time (llrint (HZ * frames_round(r) / r)); + } + double seconds () const { return double (_t) / HZ; } @@ -217,12 +225,13 @@ public: return Time (INT64_MAX); } + static const int HZ = 96000; + private: friend struct dcpomatic_time_ceil_test; friend struct dcpomatic_time_floor_test; Type _t; - static const int HZ = 96000; }; class ContentTimeDifferentiator {};