summaryrefslogtreecommitdiff
path: root/src/dcp_time.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-10-19 19:42:26 +0100
committerCarl Hetherington <cth@carlh.net>2012-10-19 19:42:26 +0100
commitaf9b2212f0d8f8c1f53aaf29e520b812dfdc321c (patch)
tree82d12ed02b489d4e0f978a333cc130f4c427ea60 /src/dcp_time.cc
parent13c6d55d16337abbd8d8969d7062a515c1b26995 (diff)
Initial work on subtitle writing.
Diffstat (limited to 'src/dcp_time.cc')
-rw-r--r--src/dcp_time.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/dcp_time.cc b/src/dcp_time.cc
index bc15c367..c9cd751a 100644
--- a/src/dcp_time.cc
+++ b/src/dcp_time.cc
@@ -75,6 +75,12 @@ libdcp::operator== (Time const & a, Time const & b)
}
bool
+libdcp::operator!= (Time const & a, Time const & b)
+{
+ return !(a == b);
+}
+
+bool
libdcp::operator<= (Time const & a, Time const & b)
{
if (a.h != b.h) {
@@ -210,3 +216,18 @@ libdcp::operator/ (Time a, Time const & b)
int64_t const bt = b.h * 3600 * 250 + b.m * 60 * 250 + b.s * 250 + b.t;
return float (at) / bt;
}
+
+string
+Time::to_string () const
+{
+ stringstream str;
+ str << h << ":" << m << ":" << s << ":" << t;
+ return str.str ();
+}
+
+int64_t
+Time::to_ticks () const
+{
+ return t + s * 25 + m * 60 * 25 + h * 60 * 60 * 25;
+}
+