X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fdcpomatic_time.h;h=dc9b0cd8ac680c6e1a3803d7805c76cdd9d14b57;hb=3f3727634b98ce2761a193b9d1e3fc14f51dcbd2;hp=55476d5b52ad6d5752344dd9a23b70d5f3770fe8;hpb=39029279954b1f346d3ba28ec12c58211bfa7436;p=dcpomatic.git diff --git a/src/lib/dcpomatic_time.h b/src/lib/dcpomatic_time.h index 55476d5b5..dc9b0cd8a 100644 --- a/src/lib/dcpomatic_time.h +++ b/src/lib/dcpomatic_time.h @@ -20,13 +20,14 @@ #ifndef DCPOMATIC_TIME_H #define DCPOMATIC_TIME_H +#include "frame_rate_change.h" +#include "safe_stringstream.h" +#include "dcpomatic_assert.h" +#include #include #include #include #include -#include -#include "frame_rate_change.h" -#include "safe_stringstream.h" class dcpomatic_round_up_test; @@ -58,9 +59,10 @@ public: template int64_t frames (T r) const { - return rint (_t * r / HZ); + return rint (double (_t) * r / HZ); } + /** @param r Frames per second */ template void split (T r, int& h, int& m, int& s, int& f) const { @@ -176,7 +178,7 @@ public: template static ContentTime from_frames (int64_t f, T r) { - assert (r > 0); + DCPOMATIC_ASSERT (r > 0); return ContentTime (f * HZ / r); } @@ -280,7 +282,7 @@ public: template static DCPTime from_frames (int64_t f, T r) { - assert (r > 0); + DCPOMATIC_ASSERT (r > 0); return DCPTime (f * HZ / r); }