From 4932fb8719e72b051252821f7c20c2034ffea3cf Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Tue, 4 Feb 2020 17:01:14 +0100 Subject: [PATCH] fix value() return in timers when timer is expired this makes sure that value() never returns a value larger than the timer duration --- lib/include/srslte/common/timers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/include/srslte/common/timers.h b/lib/include/srslte/common/timers.h index a597a4133..a969c67bd 100644 --- a/lib/include/srslte/common/timers.h +++ b/lib/include/srslte/common/timers.h @@ -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_) {