summaryrefslogtreecommitdiff
path: root/src/dcp_time.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/dcp_time.cc')
-rw-r--r--src/dcp_time.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/dcp_time.cc b/src/dcp_time.cc
index 5e8bf801..6af653ad 100644
--- a/src/dcp_time.cc
+++ b/src/dcp_time.cc
@@ -18,9 +18,28 @@
*/
#include <iostream>
+#include <cmath>
#include "dcp_time.h"
using namespace std;
+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;
+ s = floor (sec_float);
+
+ if (s > 60) {
+ m = s / 60;
+ s -= m * 60;
+ }
+
+ if (m > 60) {
+ h = m / 60;
+ m -= h * 60;
+ }
+}
bool
libdcp::operator== (Time const & a, Time const & b)