X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2FIntervalTimer.hpp;h=2f465ad92880787aa42c4f7f07e4494e30433819;hb=6513b55584093a86ce1e369e054263dd75c295c8;hp=ee84c65e1b02c068c2de7ae1c5de9ec237e52c9e;hpb=150d065f431d665326fd8028748c48a74ad956bb;p=blank.git diff --git a/src/app/IntervalTimer.hpp b/src/app/IntervalTimer.hpp index ee84c65..2f465ad 100644 --- a/src/app/IntervalTimer.hpp +++ b/src/app/IntervalTimer.hpp @@ -35,7 +35,7 @@ public: } /// true if an interval boundary was passed by the last call to Update() bool Hit() const noexcept { - return Running() && mod(value, intv) < last_dt; + return Running() && IntervalElapsed() < last_dt; } bool HitOnce() const noexcept { return Running() && value >= intv; @@ -46,6 +46,12 @@ public: Time Interval() const noexcept { return intv; } + Time IntervalElapsed() const noexcept { + return mod(value, intv); + } + Time IntervalRemain() const noexcept { + return intv - IntervalElapsed(); + } int Iteration() const noexcept { return value / intv; }