WindmillTimeUtils { public static long harnessToWindmillTimestamp(Instant timestamp) { if (!timestamp.isBefore(BoundedWindow.TIMESTAMP_MAX_VALUE)) { return Long.MAX_VALUE; } else if (timestamp.getMillis() < Long.MIN_VALUE / 1000) { return Long.MIN_VALUE + 1; } else { return timestamp.getMillis() * 1000; } }  static @Nullable Instant windmillToHarnessWatermark(long watermarkUs); static Instant windmillToHarnessTimestamp(long timestampUs); static long harnessToWindmillTimestamp(Instant timestamp);  }
@Test public void testHarnessToWindmillTimestamp() { assertEquals(Long.MAX_VALUE, harnessToWindmillTimestamp(BoundedWindow.TIMESTAMP_MAX_VALUE)); assertEquals(-1000, harnessToWindmillTimestamp(new Instant(-1))); assertEquals(1000, harnessToWindmillTimestamp(new Instant(1))); assertEquals(Long.MIN_VALUE + 1, harnessToWindmillTimestamp(new Instant(Long.MIN_VALUE))); assertEquals( Long.MIN_VALUE + 1, harnessToWindmillTimestamp(new Instant(Long.MIN_VALUE / 1000 - 1))); }