summaryrefslogtreecommitdiff
path: root/src/time_pair.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-07-15 14:28:16 +0100
committerCarl Hetherington <cth@carlh.net>2014-07-15 14:28:16 +0100
commitdc17395f3a4c19f5eea2590f1d2904e88365c67a (patch)
treec7d5a99ee538483b948b756bdf7bcbfbbb62ae2a /src/time_pair.cc
parent44a5e000d62230451cc35a239c7c3ba83d830bd7 (diff)
Add scale functions to time classes.
Diffstat (limited to 'src/time_pair.cc')
-rw-r--r--src/time_pair.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/time_pair.cc b/src/time_pair.cc
index e6708cd..9fc7974 100644
--- a/src/time_pair.cc
+++ b/src/time_pair.cc
@@ -23,25 +23,25 @@ using std::ostream;
using namespace sub;
FrameTime
-TimePair::frame (float frames_per_second) const
+TimePair::frame (float fps) const
{
if (_frame) {
return _frame.get ();
}
MetricTime const m = _metric.get ();
- return FrameTime (m.hours(), m.minutes(), m.seconds(), m.milliseconds() * frames_per_second / 1000);
+ return FrameTime (m.hours(), m.minutes(), m.seconds(), m.milliseconds() * fps / 1000);
}
MetricTime
-TimePair::metric (float frames_per_second) const
+TimePair::metric (float fps) const
{
if (_metric) {
return _metric.get ();
}
FrameTime const f = _frame.get ();
- return MetricTime (f.hours(), f.minutes(), f.seconds(), f.frames() * 1000 / frames_per_second);
+ return MetricTime (f.hours(), f.minutes(), f.seconds(), f.frames() * 1000 / fps);
}
void
@@ -54,6 +54,16 @@ TimePair::add (FrameTime t, float fps)
}
}
+void
+TimePair::scale (float f, float fps)
+{
+ if (_frame) {
+ _frame.get().scale (f, fps);
+ } else {
+ _metric.get().scale (f);
+ }
+}
+
bool
TimePair::operator== (TimePair const & other) const
{