diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-02-07 21:38:01 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-02-07 21:38:01 +0000 |
| commit | f964e99d63f5f5999ae4f245e6b25ced014d8383 (patch) | |
| tree | 31262a83652d5e4b1b6d9460843873287208ad7c /test/dcp_time_test.cc | |
| parent | f19fba719f1da6850ae320534c669196ea9d854c (diff) | |
db8af2f changed rebase() to round down when rebasing times, but
did not say why. This rounding down produces some unexpected results,
e.g. taking 41 at a TCR of 1000 to a TCR of 24 gives 0, which upsets
those who use DCP-o-matic and put in a SRT subtitle ending at ,041 ---
the sub time is rounded down to 0 for a SMPTE DCP.
This commit restores round-to-nearest behaviour.
Diffstat (limited to 'test/dcp_time_test.cc')
| -rw-r--r-- | test/dcp_time_test.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/test/dcp_time_test.cc b/test/dcp_time_test.cc index 099892b1..48a35b5a 100644 --- a/test/dcp_time_test.cc +++ b/test/dcp_time_test.cc @@ -96,14 +96,13 @@ BOOST_AUTO_TEST_CASE (dcp_time) /* Check rounding on conversion from seconds */ BOOST_CHECK_EQUAL (dcp::Time (80.990, 1000), dcp::Time (0, 1, 20, 990, 1000)); - /* Check rebase() */ + /* Check rebase */ a = dcp::Time (1, 58, 56, 2, 25); - BOOST_CHECK_EQUAL (a.rebase (250), dcp::Time (1, 58, 56, 20, 250)); + BOOST_CHECK_EQUAL (a.rebase(250), dcp::Time(1, 58, 56, 20, 250)); b = dcp::Time (9, 12, 41, 17, 99); - BOOST_CHECK_EQUAL (b.rebase (250), dcp::Time (9, 12, 41, 42, 250)); - /* We must round down in rebase() */ + BOOST_CHECK_EQUAL (b.rebase(250), dcp::Time(9, 12, 41, 43, 250)); a = dcp::Time (0, 2, 57, 999, 1000); - BOOST_CHECK_EQUAL (a.rebase (250), dcp::Time (0, 2, 57, 249, 250)); + BOOST_CHECK_EQUAL (a.rebase(250), dcp::Time(0, 2, 57, 250, 250)); /* Check some allowed constructions from string */ |
