summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-08-13 16:24:37 +0100
committerCarl Hetherington <cth@carlh.net>2012-08-13 16:24:37 +0100
commit9c1d9b7d6e8624e594d7fdf22ced0847741eb289 (patch)
tree289580476eab44836485e3638074ca767786727e /src
parent7146798d8638cddfe4b3773fb295b6c31c57c826 (diff)
4th parameter of time is ticks (1 tick = 4ms) not milliseconds
Diffstat (limited to 'src')
-rw-r--r--src/dcp_time.cc10
-rw-r--r--src/dcp_time.h8
2 files changed, 9 insertions, 9 deletions
diff --git a/src/dcp_time.cc b/src/dcp_time.cc
index 6af653ad..5b4241c4 100644
--- a/src/dcp_time.cc
+++ b/src/dcp_time.cc
@@ -27,7 +27,7 @@ using namespace libdcp;
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) {
@@ -44,7 +44,7 @@ Time::Time (int frame, int frames_per_second)
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
@@ -62,8 +62,8 @@ libdcp::operator<= (Time const & a, Time const & b)
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;
@@ -72,6 +72,6 @@ libdcp::operator<= (Time const & a, Time const & b)
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;
}
diff --git a/src/dcp_time.h b/src/dcp_time.h
index 22dcec0f..a611cd89 100644
--- a/src/dcp_time.h
+++ b/src/dcp_time.h
@@ -25,19 +25,19 @@ namespace libdcp {
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);