Time::Time (int frame, int frames_per_second)
{
float sec_float = float (frame) / frames_per_second;
- ms = int (sec_float * 1000) % 1000;
+ t = (int (sec_float * 1000) % 1000) / 4;
s = floor (sec_float);
if (s > 60) {
bool
libdcp::operator== (Time const & a, Time const & b)
{
- return (a.h == b.h && a.m == b.m && a.s == b.s && a.ms == b.ms);
+ return (a.h == b.h && a.m == b.m && a.s == b.s && a.t == b.t);
}
bool
return a.s <= b.s;
}
- if (a.ms != b.ms) {
- return a.ms <= b.ms;
+ if (a.t != b.t) {
+ return a.t <= b.t;
}
return true;
ostream &
libdcp::operator<< (ostream& s, Time const & t)
{
- s << t.h << ":" << t.m << ":" << t.s << "." << t.ms;
+ s << t.h << ":" << t.m << ":" << t.s << "." << t.t;
return s;
}
class Time
{
public:
- Time () : h (0), m (0), s (0), ms (0) {}
+ Time () : h (0), m (0), s (0), t (0) {}
Time (int frame, int frames_per_second);
- Time (int h_, int m_, int s_, int ms_)
+ Time (int h_, int m_, int s_, int t_)
: h (h_)
, m (m_)
, s (s_)
- , ms (ms_)
+ , t (t_)
{}
int h;
int m;
int s;
- int ms;
+ int t;
};
extern bool operator== (Time const & a, Time const & b);
{
libdcp::Time t (977143, 24);
- BOOST_CHECK_EQUAL (t.ms, 292);
+ BOOST_CHECK_EQUAL (t.t, 73);
BOOST_CHECK_EQUAL (t.s, 34);
BOOST_CHECK_EQUAL (t.m, 18);
BOOST_CHECK_EQUAL (t.h, 11);