]> git.localhorst.tv Git - blank.git/blobdiff - src/app/IntervalTimer.hpp
the sound thing
[blank.git] / src / app / IntervalTimer.hpp
index bcf1baef29e290fafbe90079d4daabc05052914b..06caa5e21b9bb5c805a1f2e73d68d89c855f8996 100644 (file)
@@ -13,7 +13,7 @@ class IntervalTimer {
 public:
        /// Create a timer that hits every interval_ms milliseconds.
        /// Initial state is stopped.
-       explicit IntervalTimer(int interval_ms) noexcept
+       explicit IntervalTimer(int interval_ms = 0) noexcept
        : intv(interval_ms) { }
 
        void Start() noexcept {
@@ -35,7 +35,7 @@ public:
                return Running() && value % intv < last_dt;
        }
        bool HitOnce() const noexcept {
-               return value >= intv;
+               return Running() && value >= intv;
        }
        int Elapsed() const noexcept {
                return value;