epoch_to_timestamp

Function epoch_to_timestamp 

Source
pub fn epoch_to_timestamp(epoch: u64) -> i64
Expand description

Calculate Unix timestamp from epoch number (day sequence).

§Formula

timestamp = START_AT + (epoch * EPOCH_DURATION)

§Parameters

  • epoch: Epoch number (0-based day sequence since launch)

§Returns

  • Unix timestamp in seconds (start of the epoch day)

§Epoch Alignment

  • Epoch 0: Returns Sept 1, 2025 00:00:00 UTC
  • Epoch 1: Returns Sept 2, 2025 00:00:00 UTC
  • Each epoch starts at 00:00:00 UTC of the corresponding date
  • Project launches at START_AT (10:00 AM UTC on Sept 1, 2025) within epoch 0

§Example

use miracle_api::sdk;
let timestamp = sdk::epoch_to_timestamp(0); // Returns 1756756800 (Sept 1, 2025 00:00:00 UTC)
let timestamp = sdk::epoch_to_timestamp(1); // Returns 1756843200 (Sept 2, 2025 00:00:00 UTC)