summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libcamera/timer.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libcamera/timer.cpp b/src/libcamera/timer.cpp
index 8c74e101..5d4e5271 100644
--- a/src/libcamera/timer.cpp
+++ b/src/libcamera/timer.cpp
@@ -75,6 +75,9 @@ void Timer::start(std::chrono::milliseconds duration)
<< duration.count() << ": deadline "
<< utils::time_point_to_string(deadline_);
+ if (isRunning())
+ unregisterTimer();
+
registerTimer();
}
@@ -88,6 +91,9 @@ void Timer::start(std::chrono::milliseconds duration)
*/
void Timer::stop()
{
+ if (!isRunning())
+ return;
+
unregisterTimer();
}