summaryrefslogtreecommitdiff
path: root/src/qcam
diff options
context:
space:
mode:
Diffstat (limited to 'src/qcam')
-rw-r--r--src/qcam/qt_event_dispatcher.cpp7
1 files changed, 6 insertions, 1 deletions
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 <chrono>
#include <iostream>
#include <QAbstractEventDispatcher>
@@ -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<std::chrono::milliseconds>(duration);
+ int timerId = startTimer(msec);
timers_[timerId] = timer;
timerIds_[timer] = timerId;
}