simulon/api/
time.rs

1use std::time::Duration;
2
3use crate::state::with_node;
4
5/// Returns the current time.
6pub fn now() -> u128 {
7    with_node(|n| n.now())
8}
9
10/// Returns a future that will be resolved after the provided duration is passed.
11pub async fn sleep(time: Duration) {
12    with_node(|n| n.sleep(time.as_nanos())).await;
13}