abstract class TimeWindow
An interval on the time-line; not a single instantaneous point.
There is no such thing as exact time in networked systems due to the underlying physics involved and other issues such as network latency. The best that can be approximated is "fuzzy time" or an instant of time which has margin of tolerance around it. This is what TimeWindow represents. Time windows can be open-ended (i.e. specify only one of fromTime and untilTime) or they can be fully bounded.
WireTransaction has an optional time-window property, which if specified, restricts the validity of the transaction to that time-interval as the Consensus Service will not sign it if it's received outside of this window.
<init> |
An interval on the time-line; not a single instantaneous point. TimeWindow() |
fromTime |
Returns the inclusive lower-bound of this TimeWindow's interval, with null implying infinity. abstract val fromTime: Instant? |
length |
Returns the duration between fromTime and untilTime if both are non-null. Otherwise returns null. val length: Duration? |
midpoint |
Returns the midpoint of fromTime and untilTime if both are non-null, calculated as
abstract val midpoint: Instant? |
untilTime |
Returns the exclusive upper-bound of this TimeWindow's interval, with null implying infinity. abstract val untilTime: Instant? |
contains |
Returns true iff the given instant is within the time interval of this TimeWindow. abstract operator fun contains(instant: Instant): Boolean |
between |
Creates a TimeWindow with the time interval fun between(fromTime: Instant, untilTime: Instant): TimeWindow |
fromOnly |
Creates a TimeWindow with null untilTime, i.e. the time interval fun fromOnly(fromTime: Instant): TimeWindow |
fromStartAndDuration |
Creates a TimeWindow with the time interval fun fromStartAndDuration(fromTime: Instant, duration: Duration): TimeWindow |
untilOnly |
Creates a TimeWindow with null fromTime, i.e. the time interval fun untilOnly(untilTime: Instant): TimeWindow |
withTolerance |
Creates a TimeWindow which is centered around instant with the given tolerance on both sides, i.e the
time interval fun withTolerance(instant: Instant, tolerance: Duration): TimeWindow |