From c2bacef83162cd1b01d5e581631418ea026a05b5 Mon Sep 17 00:00:00 2001 From: Ry Biesemeyer Date: Tue, 5 Feb 2019 02:11:58 +0000 Subject: [PATCH] tests: support more-precise clocks in Java 11 --- logstash-core/src/test/java/org/logstash/TimestampTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/logstash-core/src/test/java/org/logstash/TimestampTest.java b/logstash-core/src/test/java/org/logstash/TimestampTest.java index 2844bd82a51..58959ab7fe1 100644 --- a/logstash-core/src/test/java/org/logstash/TimestampTest.java +++ b/logstash-core/src/test/java/org/logstash/TimestampTest.java @@ -49,7 +49,9 @@ public void testMicroseconds() { Instant i = Instant.now(); Timestamp t1 = new Timestamp(i.toEpochMilli()); long usec = t1.usec(); - Assert.assertEquals(i.getNano() / 1000, usec); + + // since our Timestamp was created with epoch millis, it cannot be more precise. + Assert.assertEquals(i.getNano() / 1_000_000, usec / 1_000); } @Test