From e85f42110f411ec9c9b30d7f8f1a57c02e9cb01f Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 6 Oct 2019 06:40:32 +0300 Subject: libcamera: timer: Remove the interval() method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The libcamera timers are single-shot timers. They are started with a duration, but fire once only, not based on an interval. Remove the interval concept by removing the interval() method, and rename other occurences of interval to duration. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- src/qcam/qt_event_dispatcher.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/qcam/qt_event_dispatcher.cpp') diff --git a/src/qcam/qt_event_dispatcher.cpp b/src/qcam/qt_event_dispatcher.cpp index 994af3ea..9e989bef 100644 --- a/src/qcam/qt_event_dispatcher.cpp +++ b/src/qcam/qt_event_dispatcher.cpp @@ -5,6 +5,7 @@ * qt_event_dispatcher.cpp - qcam - Qt-based event dispatcher */ +#include #include #include @@ -112,7 +113,11 @@ void QtEventDispatcher::exceptionNotifierActivated(int socket) void QtEventDispatcher::registerTimer(Timer *timer) { - int timerId = startTimer(timer->interval()); + std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now(); + std::chrono::steady_clock::duration duration = timer->deadline() - now; + std::chrono::milliseconds msec = + std::chrono::duration_cast(duration); + int timerId = startTimer(msec); timers_[timerId] = timer; timerIds_[timer] = timerId; } -- cgit v1.2.1