summaryrefslogtreecommitdiff
path: root/Source/WTF
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2018-01-07 19:43:21 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2018-01-07 17:08:48 +0000
commitcb895f50d5c08976c0f5ecbb82e6bd19d9ea090d (patch)
treefd8632d48c2ee72747feaa0e2b458d591e254288 /Source/WTF
parent8cab1238d6ea14fa6a61ed4e0c5d39ccd0736ec2 (diff)
downloadqtwebkit-cb895f50d5c08976c0f5ecbb82e6bd19d9ea090d.tar.gz
Import WebKit commit 69d327017a8d700cbfc7e1120270db4d55416f41
Change-Id: I38406c67ba681f7693a45b0fa2d8c2e44a6d9a0e Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WTF')
-rw-r--r--Source/WTF/wtf/CurrentTime.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/Source/WTF/wtf/CurrentTime.cpp b/Source/WTF/wtf/CurrentTime.cpp
index 7de52f779..8774314fe 100644
--- a/Source/WTF/wtf/CurrentTime.cpp
+++ b/Source/WTF/wtf/CurrentTime.cpp
@@ -261,18 +261,7 @@ double monotonicallyIncreasingTime()
return ecore_time_get();
}
-#elif PLATFORM(QT)
-
-double monotonicallyIncreasingTime()
-{
- ASSERT(QElapsedTimer::isMonotonic());
- static QElapsedTimer timer;
- if (!timer.isValid())
- timer.start();
- return timer.nsecsElapsed() / 1.0e9;
-}
-
-#elif USE(GLIB)
+#elif USE(GLIB) && !PLATFORM(QT)
double monotonicallyIncreasingTime()
{
@@ -295,6 +284,15 @@ double monotonicallyIncreasingTime()
return (mach_absolute_time() * timebaseInfo.numer) / (1.0e9 * timebaseInfo.denom);
}
+#elif OS(LINUX) || OS(FREEBSD) || OS(OPENBSD) || OS(NETBSD)
+
+double monotonicallyIncreasingTime()
+{
+ struct timespec ts { };
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ return static_cast<double>(ts.tv_sec) + ts.tv_nsec / 1.0e9;
+}
+
#else
double monotonicallyIncreasingTime()