Skip to main content

ic_testkit/pic/
time.rs

1use pocket_ic::PocketIc;
2
3/// Focused time conversion missing from PocketIC's native API.
4///
5/// All mutation, certified-time, and round operations stay on [`PocketIc`].
6pub trait PocketIcTimeExt {
7    /// Read PocketIC wall-clock time as nanoseconds since the Unix epoch.
8    fn current_time_nanos(&self) -> u64;
9}
10
11impl PocketIcTimeExt for PocketIc {
12    fn current_time_nanos(&self) -> u64 {
13        self.get_time().as_nanos_since_unix_epoch()
14    }
15}