]> git.meshlink.io Git - catta/blobdiff - avahi-qt/qt-watch.cpp
Minor cleanups
[catta] / avahi-qt / qt-watch.cpp
index c0b21402348722b742cbc74563fac4d444a214b0..2426798a3c0d9ec47b0f362b3454bb23746165a3 100644 (file)
@@ -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
     }
 }