mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-12-08 23:03:46 +00:00
64 lines
2 KiB
Diff
64 lines
2 KiB
Diff
|
# Author: David E. Narváez <david.narvaez@computer.org>
|
||
|
# AuthorDate: 2013-02-23 23:14:50 -0500
|
||
|
# Commit: David E. Narváez <david.narvaez@computer.org>
|
||
|
# CommitDate: 2013-02-23 23:14:50 -0500
|
||
|
#
|
||
|
# Rename qAbs Function for timeval
|
||
|
#
|
||
|
# This decouples it from qAbs which is declared as a constexpr under
|
||
|
# certain compilation flags and enables for qtbase to be compiled with
|
||
|
# GCC 4.8
|
||
|
#
|
||
|
# Change-Id: I78e02256ffc8b460ca74ae5241e77dfac4e09ba9
|
||
|
diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp
|
||
|
index 0eee425..7a29247 100644
|
||
|
--- a/src/corelib/kernel/qtimerinfo_unix.cpp
|
||
|
+++ b/src/corelib/kernel/qtimerinfo_unix.cpp
|
||
|
@@ -87,22 +87,21 @@
|
||
|
firstTimerInfo = 0;
|
||
|
}
|
||
|
|
||
|
timeval QTimerInfoList::updateCurrentTime()
|
||
|
{
|
||
|
return (currentTime = qt_gettime());
|
||
|
}
|
||
|
|
||
|
#if ((_POSIX_MONOTONIC_CLOCK-0 <= 0) && !defined(Q_OS_MAC) && !defined(Q_OS_INTEGRITY)) || defined(QT_BOOTSTRAPPED)
|
||
|
|
||
|
-template <>
|
||
|
-timeval qAbs(const timeval &t)
|
||
|
+timeval qAbsTimeval(const timeval &t)
|
||
|
{
|
||
|
timeval tmp = t;
|
||
|
if (tmp.tv_sec < 0) {
|
||
|
tmp.tv_sec = -tmp.tv_sec - 1;
|
||
|
tmp.tv_usec -= 1000000;
|
||
|
}
|
||
|
if (tmp.tv_sec == 0 && tmp.tv_usec < 0) {
|
||
|
tmp.tv_usec = -tmp.tv_usec;
|
||
|
}
|
||
|
return normalizedTimeval(tmp);
|
||
|
@@ -137,21 +136,21 @@
|
||
|
*delta = elapsedTime - elapsedTimeTicks;
|
||
|
|
||
|
previousTicks = currentTicks;
|
||
|
previousTime = currentTime;
|
||
|
|
||
|
// If tick drift is more than 10% off compared to realtime, we assume that the clock has
|
||
|
// been set. Of course, we have to allow for the tick granularity as well.
|
||
|
timeval tickGranularity;
|
||
|
tickGranularity.tv_sec = 0;
|
||
|
tickGranularity.tv_usec = msPerTick * 1000;
|
||
|
- return elapsedTimeTicks < ((qAbs(*delta) - tickGranularity) * 10);
|
||
|
+ return elapsedTimeTicks < ((qAbsTimeval(*delta) - tickGranularity) * 10);
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
repair broken timer
|
||
|
*/
|
||
|
void QTimerInfoList::timerRepair(const timeval &diff)
|
||
|
{
|
||
|
// repair all timers
|
||
|
for (int i = 0; i < size(); ++i) {
|
||
|
register QTimerInfo *t = at(i);
|