]> git.localhorst.tv Git - blank.git/blobdiff - src/app/IntervalTimer.hpp
let the server wait a little more efficiently
[blank.git] / src / app / IntervalTimer.hpp
index ee84c65e1b02c068c2de7ae1c5de9ec237e52c9e..2f465ad92880787aa42c4f7f07e4494e30433819 100644 (file)
@@ -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;
        }