Crate snapshots_math

Crate snapshots_math 

Source
Expand description

Calculations for voting escrow snapshots.

These functions are split into a separate crate to ensure anchor-lang version mismatches do not prevent building against this code.

Constants§

COMMON_ERA_UNIX_TS
The Unix timestamp of the start of the first era.
ERA_NUM_PERIODS
Number of periods in an era.
PERIOD_SECONDS
Number of seconds in a period.
SECONDS_PER_ERA
Number of seconds in an era.

Functions§

calculate_era_and_period_of_ts
Calculates the era and period of the given Unix timestamp.
calculate_era_start_ts
Calculates the start timestamp of an era.
calculate_next_era_and_period
Calculates the next era and period of the given period.
calculate_next_era_and_period_of_ts
Calculates the next era and period of the given Unix timestamp.
calculate_period_start_ts
Calculates the start timestamp of a period of an era.
has_period_elapsed
A period is elapsed if its start time has passed.