Skip to content

Commit

Permalink
convert windmill min timestamp to beam min timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Naireen Hussain committed Jun 8, 2022
1 parent 6d6a54d commit f3da913
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public class WindmillTimeUtils {
public static Instant windmillToHarnessTimestamp(long timestampUs) {
// Windmill should never send us an unknown timestamp.
Preconditions.checkArgument(timestampUs != Long.MIN_VALUE);
// Set windmill min timestamp to beam min timestamp
if(timestampUs == Long.MIN_VALUE +1){
return BoundedWindow.TIMESTAMP_MIN_VALUE;
}
Instant result = new Instant(divideAndRoundDown(timestampUs, 1000));
if (result.isAfter(BoundedWindow.TIMESTAMP_MAX_VALUE)) {
// End of time.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public void testWindmillToHarnessTimestamp() {
assertEquals(new Instant(-17), windmillToHarnessTimestamp(-16987));
assertEquals(new Instant(-17), windmillToHarnessTimestamp(-17000));
assertEquals(new Instant(-18), windmillToHarnessTimestamp(-17001));
assertEquals(BoundedWindow.TIMESTAMP_MIN_VALUE, windmillToHarnessTimestamp(Long.MIN_VALUE + 1));
}

@Test
Expand Down

0 comments on commit f3da913

Please sign in to comment.