is_timestamp_valid

Function is_timestamp_valid 

Source
pub fn is_timestamp_valid(timestamp_ms: i64, tolerance_ms: i64) -> bool
Expand description

Check if a timestamp is within the valid range (not too old, not in future).

ยงExamples

use chie_shared::{now_ms, is_timestamp_valid};

// Recent timestamp is valid
let recent = now_ms() - 1000; // 1 second ago
assert!(is_timestamp_valid(recent, 5000)); // 5 second tolerance

// Old timestamp is invalid
let old = now_ms() - 10000; // 10 seconds ago
assert!(!is_timestamp_valid(old, 5000)); // Only 5 second tolerance

// Future timestamp is always invalid
let future = now_ms() + 1000;
assert!(!is_timestamp_valid(future, 5000));