public static long harnessToWindmillTimestamp(Instant timestamp) {
    if (!timestamp.isBefore(BoundedWindow.TIMESTAMP_MAX_VALUE)) {
      // End of time.
      return Long.MAX_VALUE;
    } else if (timestamp.getMillis() < Long.MIN_VALUE / 1000) {
      return Long.MIN_VALUE + 1;
    } else {
      return timestamp.getMillis() * 1000;
    }
  }
@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)));
  }