From cb895f50d5c08976c0f5ecbb82e6bd19d9ea090d Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Sun, 7 Jan 2018 19:43:21 +0300 Subject: Import WebKit commit 69d327017a8d700cbfc7e1120270db4d55416f41 Change-Id: I38406c67ba681f7693a45b0fa2d8c2e44a6d9a0e Reviewed-by: Konstantin Tokarev --- Source/WTF/wtf/CurrentTime.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'Source/WTF') 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(ts.tv_sec) + ts.tv_nsec / 1.0e9; +} + #else double monotonicallyIncreasingTime() -- cgit v1.2.1