X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fdcp_time.cc;h=7d3111d270fbef814e05a7a398f8eadd9978023e;hb=938f413bb4ebecd51c805027e331cb7eb0ca9502;hp=15ad05d430d84da9f4282c0617100a5cec70a0f5;hpb=41daa5821b3d3b0f450094fbf0d1e37a449f482c;p=libdcp.git diff --git a/src/dcp_time.cc b/src/dcp_time.cc index 15ad05d4..7d3111d2 100644 --- a/src/dcp_time.cc +++ b/src/dcp_time.cc @@ -39,9 +39,14 @@ Time::Time (int frame, int frames_per_second) , s (0) , t (0) { - float sec_float = float (frame) / frames_per_second; - t = (int (floor (sec_float * 1000)) % 1000) / 4; - s = floor (sec_float); + set (double (frame) / frames_per_second); +} + +void +Time::set (double ss) +{ + t = (int (round (ss * 1000)) % 1000) / 4; + s = floor (ss); if (s > 60) { m = s / 60; @@ -59,7 +64,7 @@ Time::Time (string time) vector b; split (b, time, is_any_of (":")); if (b.size() != 4) { - throw DCPReadError ("unrecognised time specification"); + boost::throw_exception (DCPReadError ("unrecognised time specification")); } h = lexical_cast (b[0]);