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.
TimeWindow()
An interval on the time-line; not a single instantaneous point. |
abstract val fromTime: Instant?
Returns the inclusive lower-bound of this TimeWindow's interval, with null implying infinity. |
|
val length: Duration?
Returns the duration between fromTime and untilTime if both are non-null. Otherwise returns null. |
|
abstract val midpoint: Instant?
Returns the midpoint of fromTime and untilTime if both are non-null, calculated as
|
|
abstract val untilTime: Instant?
Returns the exclusive upper-bound of this TimeWindow's interval, with null implying infinity. |
abstract operator fun contains(instant: Instant): Boolean
Returns true iff the given instant is within the time interval of this TimeWindow. |
fun between(fromTime: Instant, untilTime: Instant): TimeWindow
Creates a TimeWindow with the time interval |
|
fun fromOnly(fromTime: Instant): TimeWindow
Creates a TimeWindow with null untilTime, i.e. the time interval |
|
fun fromStartAndDuration(fromTime: Instant, duration: Duration): TimeWindow
Creates a TimeWindow with the time interval |
|
fun untilOnly(untilTime: Instant): TimeWindow
Creates a TimeWindow with null fromTime, i.e. the time interval |
|
fun withTolerance(instant: Instant, tolerance: Duration): TimeWindow
Creates a TimeWindow which is centered around instant with the given tolerance on both sides, i.e the
time interval |
fun Any.contextLogger(): <ERROR CLASS>
When called from a companion object, returns the logger for the enclosing class. |