diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/dcp_time.cc | 5 | ||||
| -rw-r--r-- | src/dcp_time.h | 1 | ||||
| -rw-r--r-- | src/types.h | 4 |
3 files changed, 10 insertions, 0 deletions
diff --git a/src/dcp_time.cc b/src/dcp_time.cc index a3822ed0..35cd747a 100644 --- a/src/dcp_time.cc +++ b/src/dcp_time.cc @@ -249,3 +249,8 @@ Time::to_ticks () const return int64_t(t) + int64_t(s) * 250 + int64_t(m) * 60 * 250 + int64_t(h) * 60 * 60 * 250; } +double +Time::to_seconds () const +{ + return double (to_ticks ()) / 250; +} diff --git a/src/dcp_time.h b/src/dcp_time.h index 697ca230..027cb9d2 100644 --- a/src/dcp_time.h +++ b/src/dcp_time.h @@ -68,6 +68,7 @@ public: std::string to_string () const; int64_t to_ticks () const; + double to_seconds () const; private: void set (double); diff --git a/src/types.h b/src/types.h index 680f7be8..040e6197 100644 --- a/src/types.h +++ b/src/types.h @@ -101,6 +101,10 @@ public: */ Fraction (int n, int d) : numerator (n), denominator (d) {} + float as_float () const { + return float (numerator) / denominator; + } + int numerator; int denominator; }; |
