X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2FTimer.h;h=d744fe09966cc203e76982695a1824e05946ed14;hb=b9e715649b41cb69ea1b2d2a588522541eb87b46;hp=05d295ee77d01cd21304edc660f70293131b3fd2;hpb=ede708d4e15a34a4443727fc64fd28946fcbeb41;p=l2e.git diff --git a/src/app/Timer.h b/src/app/Timer.h index 05d295e..d744fe0 100644 --- a/src/app/Timer.h +++ b/src/app/Timer.h @@ -1,10 +1,3 @@ -/* - * Timer.h - * - * Created on: Aug 10, 2012 - * Author: holy - */ - #ifndef APP_TIMER_H_ #define APP_TIMER_H_ @@ -75,6 +68,18 @@ public: Time Remaining() const { return data ? (data->target - data->time) : Time(); } + /// Time from start to hit. + Time TargetTime() const { + return data ? data->target : Time(); + } + /// Get the elapsed time since the timer started or last hit. + Time IterationElapsed() const { + return data ? data->time % data->target : Time(); + } + /// Get the remaining time in this iteration. + Time IterationRemaining() const { + return TargetTime() - IterationElapsed(); + } /// Get the iteration index for interval timers. int Iteration() const { return (data && data->target > Time()) ? std::floor(data->time / data->target) : Time(); @@ -162,4 +167,4 @@ private: } -#endif /* APP_TIMER_H_ */ +#endif