Package dev.gmitch215.bytebox.sync
Class Deadline
java.lang.Object
dev.gmitch215.bytebox.sync.Deadline
Timeouts measured on the clock a sleeping fiber is woken by.
System.nanoTime does not move across a sleep under the loader's default virtual time
policy, so a timed wait that counted with it never saw its time run out while another fiber's timer
was pending. System.currentTimeMillis moves with the scheduler under either policy.
- Since:
- 1.0.3
-
Method Summary
-
Method Details
-
after
public static long after(long nanos) - Parameters:
nanos- how far ahead, in nanoseconds- Returns:
- the wall-clock millisecond that is that far from now, rounded up
-
left
public static long left(long deadline) - Parameters:
deadline- a value fromafter(long)- Returns:
- the milliseconds left, zero or negative once it has passed
-