changeset 58189:ee448a1f33cc

8235475: Add additional timestamp to test java/nio/channels/Selector/SelectWithConsumer.java Reviewed-by: alanb
author michaelm
date Fri, 06 Dec 2019 14:17:25 +0000
parents 87fb3f5a499c
children 948012822469
files test/jdk/java/nio/channels/Selector/SelectWithConsumer.java
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/java/nio/channels/Selector/SelectWithConsumer.java	Fri Dec 06 14:31:05 2019 +0100
+++ b/test/jdk/java/nio/channels/Selector/SelectWithConsumer.java	Fri Dec 06 14:17:25 2019 +0000
@@ -454,13 +454,17 @@
 
         // select(Consumer, timeout)
         try (Selector sel = Selector.open()) {
+            long before = System.nanoTime();
             scheduleClose(sel, 3, SECONDS);
-            long start = System.currentTimeMillis();
+            long start = System.nanoTime();
             int n = sel.select(k -> assertTrue(false), 60*1000);
-            long duration = System.currentTimeMillis() - start;
+            long after = System.nanoTime();
+            long selectDuration = (after - start) / 1000000;
+            long scheduleDuration = (start - before) / 1000000;
             assertTrue(n == 0);
-            assertTrue(duration > 2000 && duration < 10*1000,
-                    "select took " + duration + " ms");
+            assertTrue(selectDuration > 2000 && selectDuration < 10*1000,
+                    "select took " + selectDuration + " ms schedule took " +
+                    scheduleDuration + " ms");
             assertFalse(sel.isOpen());
         }
     }