From 7bb4f3764c0b4d5b2b334c5d5adc4933f4769a5c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 11 Jun 2020 22:35:37 +0200 Subject: [PATCH] LibCore: Add Timer::restart() convenience API This simply restarts the timer with the existing millisecond interval. --- Libraries/LibCore/Timer.cpp | 5 +++++ Libraries/LibCore/Timer.h | 1 + 2 files changed, 6 insertions(+) diff --git a/Libraries/LibCore/Timer.cpp b/Libraries/LibCore/Timer.cpp index 32d4eea23e..aa0a0cb17d 100644 --- a/Libraries/LibCore/Timer.cpp +++ b/Libraries/LibCore/Timer.cpp @@ -58,6 +58,11 @@ void Timer::start(int interval) m_active = true; } +void Timer::restart() +{ + restart(m_interval); +} + void Timer::restart(int interval) { if (m_active) diff --git a/Libraries/LibCore/Timer.h b/Libraries/LibCore/Timer.h index 9f5aab0056..33855873a1 100644 --- a/Libraries/LibCore/Timer.h +++ b/Libraries/LibCore/Timer.h @@ -46,6 +46,7 @@ public: void start(); void start(int interval); + void restart(); void restart(int interval); void stop();