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
fromTime
and untilTime
) 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.
class TimeWindow
,
fromTime
,
untilTime
,
class WireTransaction
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
fromTime
and untilTime
) 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.
class TimeWindow
,
fromTime
,
untilTime
,
class WireTransaction
@Nullable public java.time.Instant getFromTime()
Returns the inclusive lower-bound of this class TimeWindow
's interval, with null implying infinity.
class TimeWindow
@Nullable public java.time.Instant getUntilTime()
Returns the exclusive upper-bound of this class TimeWindow
's interval, with null implying infinity.
class TimeWindow
@Nullable public java.time.Instant getMidpoint()
public boolean contains(@NotNull java.time.Instant instant)
Returns true iff the given instant
is within the time interval of this class TimeWindow
.
instant
,
class TimeWindow
@JvmStatic @NotNull public static TimeWindow fromOnly(@NotNull java.time.Instant fromTime)
Creates a class TimeWindow
with null untilTime
, i.e. the time interval [fromTime, ∞)
. midpoint
will return null.
class TimeWindow
,
untilTime
,
midpoint
@JvmStatic @NotNull public static TimeWindow untilOnly(@NotNull java.time.Instant untilTime)
Creates a class TimeWindow
with null fromTime
, i.e. the time interval (∞, untilTime)
. midpoint
will return null.
class TimeWindow
,
fromTime
,
midpoint
@JvmStatic @NotNull public static TimeWindow between(@NotNull java.time.Instant fromTime, @NotNull java.time.Instant untilTime)
Creates a class TimeWindow
with the time interval [fromTime, untilTime)
. midpoint
will return
fromTime + (untilTime - fromTime) / 2
.
IllegalArgumentException
- If fromTime
≥ untilTime
class TimeWindow
,
midpoint
@JvmStatic @NotNull public static TimeWindow fromStartAndDuration(@NotNull java.time.Instant fromTime, @NotNull java.time.Duration duration)
Creates a class TimeWindow
with the time interval [fromTime, fromTime + duration)
. midpoint
will return
fromTime + duration / 2
class TimeWindow
,
midpoint
@JvmStatic @NotNull public static TimeWindow withTolerance(@NotNull java.time.Instant instant, @NotNull java.time.Duration tolerance)
Creates a class TimeWindow
which is centered around instant
with the given tolerance
on both sides, i.e the
time interval [instant - tolerance, instant + tolerance)
. midpoint
will return instant
.
class TimeWindow
,
instant
,
tolerance
,
midpoint
,
instant