[][src]Trait slot_clock::SlotClock

pub trait SlotClock: Send + Sync + Sized {
    fn new(
        genesis_slot: Slot,
        genesis_duration: Duration,
        slot_duration: Duration
    ) -> Self;
fn now(&self) -> Option<Slot>;
fn slot_duration(&self) -> Duration;
fn duration_to_next_slot(&self) -> Option<Duration>; }

A clock that reports the current slot.

The clock is not required to be monotonically increasing and may go backwards.

Required methods

fn new(
    genesis_slot: Slot,
    genesis_duration: Duration,
    slot_duration: Duration
) -> Self

Creates a new slot clock where the first slot is genesis_slot, genesis occured genesis_duration after the UNIX_EPOCH and each slot is slot_duration apart.

fn now(&self) -> Option<Slot>

Returns the slot at this present time.

fn slot_duration(&self) -> Duration

Returns the duration between slots

fn duration_to_next_slot(&self) -> Option<Duration>

Returns the duration until the next slot.

Loading content...

Implementors

impl SlotClock for SystemTimeSlotClock[src]

impl SlotClock for TestingSlotClock[src]

fn duration_to_next_slot(&self) -> Option<Duration>[src]

Always returns a duration of 1 second.

fn slot_duration(&self) -> Duration[src]

Always returns a slot duration of 0 seconds.

Loading content...