< prev index next >
modules/web/src/main/native/Source/WTF/wtf/CurrentTime.cpp
Print this page
@@ -65,10 +65,24 @@
#endif
namespace WTF {
+#if PLATFORM(JAVA) && OS(LINUX)
+
+static const double hundredsOfNSecPerMillisecond = 10000;
+
+double clockTimeNow()
+{
+ auto now = std::chrono::steady_clock::now();
+ return static_cast<double>(std::chrono::duration_cast<std::chrono::microseconds>(
+ now.time_since_epoch()).count()) /
+ static_cast<double>(hundredsOfNSecPerMillisecond);
+}
+
+#endif
+
#if OS(WINDOWS)
// Number of 100 nanosecond between January 1, 1601 and January 1, 1970.
static const ULONGLONG epochBias = 116444736000000000ULL;
static const double hundredsOfNanosecondsPerMillisecond = 10000;
@@ -310,16 +324,11 @@
#else
double monotonicallyIncreasingTime()
{
- static double lastTime = 0;
- double currentTimeNow = currentTime();
- if (currentTimeNow < lastTime)
- return lastTime;
- lastTime = currentTimeNow;
- return currentTimeNow;
+ return clockTimeNow();
}
#endif
std::chrono::microseconds currentCPUTime()
< prev index next >