Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Clock ¶
type Clock struct { syncutils.RWMutex // Module embeds the required methods of the modular framework. module.Module // contains filtered or unexported fields }
Clock implements the clock.Clock interface that sources its notion of time from accepted and confirmed blocks.
func (*Clock) Accepted ¶
func (c *Clock) Accepted() clock.RelativeTime
Accepted returns a notion of time that is anchored to the latest accepted block.
func (*Clock) Confirmed ¶
func (c *Clock) Confirmed() clock.RelativeTime
Confirmed returns a notion of time that is anchored to the latest confirmed block.
type RelativeTime ¶
type RelativeTime struct { // OnUpdated is triggered when the time is updated. OnUpdated *event.Event1[time.Time] // contains filtered or unexported fields }
RelativeTime is a time value that monotonically advances with the system clock.
func NewRelativeTime ¶
func NewRelativeTime() *RelativeTime
NewRelativeTime creates a new RelativeTime.
func (*RelativeTime) Advance ¶
func (c *RelativeTime) Advance(newTime time.Time) (updated bool)
Advance advances the time value if the given time is larger than the current time (maintaining monotonicity of the relative time).
func (*RelativeTime) RelativeTime ¶
func (c *RelativeTime) RelativeTime() time.Time
RelativeTime returns the time value after it has advanced with the system clock.
func (*RelativeTime) Reset ¶
func (c *RelativeTime) Reset(newTime time.Time)
Reset resets the time value to the given time (resetting monotonicity of the relative time).
func (*RelativeTime) Set ¶
func (c *RelativeTime) Set(newTime time.Time) (updated bool)
Set sets the time value if the given time is larger than the current time (resetting monotonicity of the relative time).
func (*RelativeTime) Time ¶
func (c *RelativeTime) Time() time.Time
Time returns the original time value.