simulon 0.0.8

A simulation engine for distributed algorithms
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::time::Duration;

use crate::state::with_node;

/// Returns the current time.
pub fn now() -> u128 {
    with_node(|n| n.now())
}

/// Returns a future that will be resolved after the provided duration is passed.
pub async fn sleep(time: Duration) {
    with_node(|n| n.sleep(time.as_nanos())).await;
}