summaryrefslogtreecommitdiffstats
path: root/avahi-qt/qt-watch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'avahi-qt/qt-watch.cpp')
-rw-r--r--avahi-qt/qt-watch.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/avahi-qt/qt-watch.cpp b/avahi-qt/qt-watch.cpp
index c0b2140..2426798 100644
--- a/avahi-qt/qt-watch.cpp
+++ b/avahi-qt/qt-watch.cpp
@@ -125,12 +125,11 @@ void AvahiTimeout::update(const struct timeval *tv)
{
m_timer.stop();
if (tv) {
- struct timeval now;
- gettimeofday(&now, 0);
+ AvahiUsec u = avahi_age(tv)/1000;
#ifdef QT4
- m_timer.start((tv->tv_sec-now.tv_sec)*1000+(tv->tv_usec-now.tv_usec)/1000);
+ m_timer.start( (u>0) ? 0 : -u);
#else
- m_timer.start((tv->tv_sec-now.tv_sec)*1000+(tv->tv_usec-now.tv_usec)/1000,true);
+ m_timer.start( (u>0) ? 0 : -u,true);
#endif
}
}