summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qeventdispatcher_blackberry.cpp
diff options
context:
space:
mode:
authorFabian Bumberger <fbumberger@rim.com>2013-01-29 15:01:45 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-30 13:00:02 +0100
commit36f64ec6ac07b3d02838b75f80efc445fd923891 (patch)
treee1abe1b011fedd033af81d7a27bf4908878d6118 /src/corelib/kernel/qeventdispatcher_blackberry.cpp
parent6bd03762d457ed7bea3cd4e856f629430c475553 (diff)
Work around posix violation in qnx (missing pselect())
Change-Id: I7c1ae85ee7e92da3f394b488643613894977556e Reviewed-by: Peter Hartmann <phartmann@rim.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Bernd Weimer <bweimer@rim.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qeventdispatcher_blackberry.cpp')
-rw-r--r--src/corelib/kernel/qeventdispatcher_blackberry.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_blackberry.cpp b/src/corelib/kernel/qeventdispatcher_blackberry.cpp
index 3e958ee277..5206334c09 100644
--- a/src/corelib/kernel/qeventdispatcher_blackberry.cpp
+++ b/src/corelib/kernel/qeventdispatcher_blackberry.cpp
@@ -271,13 +271,13 @@ void QEventDispatcherBlackberry::unregisterSocketNotifier(QSocketNotifier *notif
}
}
-static inline int timevalToMillisecs(const timeval &tv)
+static inline int timespecToMillisecs(const timespec &tv)
{
- return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
+ return (tv.tv_sec * 1000) + (tv.tv_nsec / 1000000);
}
int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
- timeval *timeout)
+ timespec *timeout)
{
Q_UNUSED(nfds);
Q_D(QEventDispatcherBlackberry);
@@ -306,9 +306,9 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef
// Convert timeout to milliseconds
int timeoutTotal = -1;
if (timeout)
- timeoutTotal = timevalToMillisecs(*timeout);
+ timeoutTotal = timespecToMillisecs(*timeout);
int timeoutLeft = timeoutTotal;
- timeval startTime = qt_gettime();
+ timespec startTime = qt_gettime();
// This loop exists such that we can drain the bps event queue of all native events
// more efficiently than if we were to return control to Qt after each event. This
@@ -332,16 +332,16 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef
// Update the timeout
// Clock source is monotonic, so we can recalculate how much timeout is left
if (timeoutTotal != -1) {
- timeval t2 = qt_gettime();
+ timespec t2 = qt_gettime();
timeoutLeft = timeoutTotal
- - (timevalToMillisecs(t2) - timevalToMillisecs(startTime));
+ - (timespecToMillisecs(t2) - timespecToMillisecs(startTime));
if (timeoutLeft < 0)
timeoutLeft = 0;
}
- timeval tnext;
+ timespec tnext;
if (d->timerList.timerWait(tnext)) {
- int timeoutNext = timevalToMillisecs(tnext);
+ int timeoutNext = timespecToMillisecs(tnext);
if (timeoutNext < timeoutLeft || timeoutTotal == -1) {
timeoutTotal = timeoutLeft = timeoutNext;
startTime = qt_gettime();