projects
/
libsub.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Add Time::all_as_seconds().
[libsub.git]
/
src
/
sub_time.cc
diff --git
a/src/sub_time.cc
b/src/sub_time.cc
index e304310677b4b6dc42542dbcbafa2481e52c72f2..3f4d1e984788cbda4a7ebe47e9d86adadef13d27 100644
(file)
--- 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 ();
+}