summaryrefslogtreecommitdiff
path: root/src/sub_time.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-01-17 01:30:10 +0000
committerCarl Hetherington <cth@carlh.net>2015-01-20 11:20:49 +0000
commite70f560b63aa5c17d2f7f102f232cf4d5cd4c807 (patch)
treea501629c7e34dc7db53a34fd7f05e3c71e029235 /src/sub_time.cc
parent0d9495a6e6b18d1d713f3dcfb89f87d9c791f11f (diff)
Add Time::all_as_seconds().
Diffstat (limited to 'src/sub_time.cc')
-rw-r--r--src/sub_time.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/sub_time.cc b/src/sub_time.cc
index e304310..3f4d1e9 100644
--- a/src/sub_time.cc
+++ b/src/sub_time.cc
@@ -152,3 +152,13 @@ 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
+{
+ if (!_rate) {
+ throw UnknownFrameRateError ();
+ }
+
+ return _seconds + double (_frames) / _rate.get().fraction ();
+}