From 2b308d4cb5cdf2f3374404c83dc0b193fcb78612 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 15 Nov 2012 18:16:30 +0100 Subject: Fix QMutex::tryLock timeout computation on Linux The timeout is in millisecond. So we just need to divide by 1000 to get the number of seconds Regression introduced in f587e8f4fd670f11fa1e878c1015d7241033559a Reported in the comments of QTBUG-24795 Change-Id: Id16e05e7d04d33605860926f7516d14cdefd6a36 Reviewed-by: Thiago Macieira --- src/corelib/thread/qmutex_linux.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/thread/qmutex_linux.cpp') diff --git a/src/corelib/thread/qmutex_linux.cpp b/src/corelib/thread/qmutex_linux.cpp index 1644469763..4f70014acb 100644 --- a/src/corelib/thread/qmutex_linux.cpp +++ b/src/corelib/thread/qmutex_linux.cpp @@ -188,8 +188,8 @@ bool lockInternal_helper(QBasicAtomicPointer &d_ptr, int timeout = - QElapsedTimer elapsedTimer; checkElapsedTimerIsTrivial(); if (IsTimed) { - ts.tv_sec = timeout / Q_INT64_C(1000) / 1000 / 1000; - ts.tv_nsec = timeout % Q_INT64_C(1000) * 1000 * 1000; + ts.tv_sec = timeout / 1000; + ts.tv_nsec = (timeout % 1000) * 1000 * 1000; elapsedTimer.start(); } -- cgit v1.2.3