From 3617e3b36d2076795bf0dca9935a41fae849c696 Mon Sep 17 00:00:00 2001 From: Michael Chapman Date: Thu, 16 Apr 2015 19:27:36 +1000 Subject: [PATCH] virCondWaitUntil: calculate timespec correctly ts.tv_nsec was off by a factor of 1000, making timeouts less than a second in the future often expiring immediately. Signed-off-by: Michael Chapman --- src/util/virthread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virthread.c b/src/util/virthread.c index c2a9e7faaa..6c495158f5 100644 --- a/src/util/virthread.c +++ b/src/util/virthread.c @@ -164,7 +164,7 @@ int virCondWaitUntil(virCondPtr c, virMutexPtr m, unsigned long long whenms) struct timespec ts; ts.tv_sec = whenms / 1000; - ts.tv_nsec = (whenms % 1000) * 1000; + ts.tv_nsec = (whenms % 1000) * 1000000; if ((ret = pthread_cond_timedwait(&c->cond, &m->lock, &ts)) != 0) { errno = ret;