diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-01-20 11:14:49 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-01-20 11:14:49 +0000 |
| commit | 92f849621c9756fa60e89fc937d27444e72f64c8 (patch) | |
| tree | 72a6ba36018404bcac68b0efbd9bc10611262bd8 /src | |
| parent | 50421d7b24d8019266d4f7a46f7ef53b8978a3be (diff) | |
Add Time::all_as_seconds.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sub_time.cc | 6 | ||||
| -rw-r--r-- | src/sub_time.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/sub_time.cc b/src/sub_time.cc index e304310..ed61cb4 100644 --- a/src/sub_time.cc +++ b/src/sub_time.cc @@ -152,3 +152,9 @@ Time::from_hms (int h, int m, int s, int ms) { return Time (h * 3600 + m * 60 + s, ms, Rational (1000, 1)); } + +double +Time::all_as_seconds () const +{ + return seconds() + double(milliseconds ()) / 1000; +} diff --git a/src/sub_time.h b/src/sub_time.h index 7e1d193..22178e9 100644 --- a/src/sub_time.h +++ b/src/sub_time.h @@ -55,6 +55,8 @@ public: int frames_at (Rational rate) const; int milliseconds () const; + double all_as_seconds () const; + 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); |
