Hi,

Please review the code change required to backport JDK-8196681 to 8u.

Bug: https://bugs.openjdk.java.net/browse/JDK-8196681

Original review thread: http://mail.openjdk.java.net/pipermail/awt-dev/2018-September/014302.html

11u changeset: https://hg.openjdk.java.net/jdk-updates/jdk11u-dev/rev/af9ad0ae9039

Patch does not apply cleanly, because std::chrono is used for timestamps. And this part of C++11 standard is not supported by VS2010 toolchain that is used for 8u windows builds. The following change reimplements the same timestamps without std::chrono:


 auto getTimeStamp() -> long long {
-    using namespace std::chrono;
- auto timeNow = duration_cast<milliseconds>(steady_clock::now().time_since_epoch());
-
-    return timeNow.count();
+    LARGE_INTEGER freqLarge;
+    ::QueryPerformanceFrequency(&freqLarge);
+    long long freq = freqLarge.QuadPart;
+    LARGE_INTEGER counterLarge;
+    ::QueryPerformanceCounter(&counterLarge);
+    long long counter = counterLarge.QuadPart;
+    long long milliDen = 1000;
+    long long whole = (counter / freq) * milliDen;
+    long long part = (counter % freq) * milliDen / freq;
+    return whole + part;
 }


Backport also depends on JDK-8077707 and JDK-8132249 (both apply cleanly), "jdk8u-fix-request" label was added for them.

Backport requires CSR that was filed in JDK-8230699.

Thanks!

--
-Alex

Reply via email to