fix value() return in timers when timer is expired

this makes sure that value() never returns a value larger
than the timer duration
This commit is contained in:
Andre Puschmann 2020-02-04 17:01:14 +01:00
parent 5b14a7d585
commit 4932fb8719
1 changed files with 1 additions and 1 deletions

View File

@ -69,7 +69,7 @@ class timer_handler
bool is_expired() const { return active and not running and timeout > 0 and timeout <= parent->cur_time; }
uint32_t value() const { return parent->cur_time - (timeout - duration); }
uint32_t value() const { return std::min(duration, parent->cur_time - (timeout - duration)); }
bool set(uint32_t duration_)
{