public 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 class TimeWindow
represents. Time windows can be open-ended (i.e. specify only one of
TimeWindow.getFromTime
and TimeWindow.getUntilTime
) or they can be fully bounded.
class 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.
Modifier and Type | Class and Description |
---|---|
static class |
TimeWindow.Companion |
Modifier and Type | Field and Description |
---|---|
static TimeWindow.Companion |
Companion |
Constructor and Description |
---|
TimeWindow()
An interval on the time-line; not a single instantaneous point.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(java.time.Instant instant)
Returns true iff the given instant is within the time interval of this
class TimeWindow . |
java.time.Instant |
getFromTime()
Returns the inclusive lower-bound of this
class TimeWindow 's interval, with null implying infinity. |
java.time.Duration |
getLength()
Returns the duration between
TimeWindow.getFromTime and TimeWindow.getUntilTime if both are non-null. Otherwise returns null. |
java.time.Instant |
getMidpoint()
Returns the midpoint of
TimeWindow.getFromTime and TimeWindow.getUntilTime if both are non-null, calculated as
fromTime + (untilTime - fromTime) / 2 , otherwise returns null. |
java.time.Instant |
getUntilTime()
Returns the exclusive upper-bound of this
class TimeWindow 's interval, with null implying infinity. |
public static TimeWindow.Companion Companion
public 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 class TimeWindow
represents. Time windows can be open-ended (i.e. specify only one of
TimeWindow.getFromTime
and TimeWindow.getUntilTime
) or they can be fully bounded.
class 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.
public java.time.Instant getFromTime()
Returns the inclusive lower-bound of this class TimeWindow
's interval, with null implying infinity.
class TimeWindow
public java.time.Instant getUntilTime()
Returns the exclusive upper-bound of this class TimeWindow
's interval, with null implying infinity.
class TimeWindow
public java.time.Instant getMidpoint()
Returns the midpoint of TimeWindow.getFromTime
and TimeWindow.getUntilTime
if both are non-null, calculated as
fromTime + (untilTime - fromTime) / 2
, otherwise returns null.
TimeWindow.getFromTime
,
TimeWindow.getUntilTime
public java.time.Duration getLength()
Returns the duration between TimeWindow.getFromTime
and TimeWindow.getUntilTime
if both are non-null. Otherwise returns null.
TimeWindow.getFromTime
,
TimeWindow.getUntilTime
public boolean contains(java.time.Instant instant)
Returns true iff the given instant is within the time interval of this class TimeWindow
.
class TimeWindow