summaryrefslogtreecommitdiffstats
path: root/avahi-qt
diff options
context:
space:
mode:
authorJakub Stachowski <qbast@go2.pl>2005-10-01 20:34:56 +0000
committerJakub Stachowski <qbast@go2.pl>2005-10-01 20:34:56 +0000
commit08368892fe7793f1f6380699410fa755e2216d37 (patch)
tree24214f5459aacb83e586a4f36c40ffd25cec832d /avahi-qt
parent9519191947bd7695208c6c57dc9db297323853a3 (diff)
Better fix for negative timeout problem.
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@669 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-qt')
-rw-r--r--avahi-qt/qt-watch.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/avahi-qt/qt-watch.cpp b/avahi-qt/qt-watch.cpp
index 627d3d9..2426798 100644
--- a/avahi-qt/qt-watch.cpp
+++ b/avahi-qt/qt-watch.cpp
@@ -124,17 +124,14 @@ AvahiTimeout::AvahiTimeout(const struct timeval* tv, AvahiTimeoutCallback callba
void AvahiTimeout::update(const struct timeval *tv)
{
m_timer.stop();
- if (tv)
- if (tv->tv_sec==0 && tv->tv_usec==0) timeout(); // absolute timeval they say ...
- else {
- struct timeval now;
- gettimeofday(&now, 0);
+ if (tv) {
+ 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
- }
+ }
}
void AvahiTimeout::timeout()