diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-12-16 21:39:28 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-12-16 21:39:28 +0000 |
| commit | 485794f8322b090a22da841961025b19642e42a2 (patch) | |
| tree | b6f7fd430fe5de560bc6505eafc9c4e3729e7bed /src/sub_time.h | |
| parent | 44ff188fa75cb7954fb1b9bec6b1cb03d8536ef7 (diff) | |
Some missing headers; Time tweaks.
Diffstat (limited to 'src/sub_time.h')
| -rw-r--r-- | src/sub_time.h | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/sub_time.h b/src/sub_time.h index 7abdedb..93088cb 100644 --- a/src/sub_time.h +++ b/src/sub_time.h @@ -20,26 +20,11 @@ #ifndef LIBSUB_SUB_TIME_H #define LIBSUB_SUB_TIME_H +#include "rational.h" #include <boost/optional.hpp> namespace sub { -class Rational -{ -public: - Rational (int numerator_, int denominator_) - : numerator (numerator_) - , denominator (denominator_) - {} - - int numerator; - int denominator; - - double fraction () const { - return double (numerator) / denominator; - } -}; - class Time { public: @@ -57,8 +42,12 @@ public: double all_as_seconds () const; + void add (Time t); + void scale (float f); + static Time from_hmsf (int h, int m, int s, int f, boost::optional<Rational> rate = boost::optional<Rational> ()); static Time from_hms (int h, int m, int s, int ms); + static Time from_frames (int frames, Rational rate); private: friend bool operator< (Time const & a, Time const & b); |
