tempest-rt 0.0.1

TempestDB Deterministic Async Runtime
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use tempest_io::Io;

use crate::context::current_io;

/// Retrieves the current duration since the epoch start start from I/O.
/// The type parameter `I` must match the [`Io`] implementation this runtime was initialized with.
///
/// # Panics
///
/// Panics if called outside of an active runtime or if `I` does not match the runtime's I/O type.
pub fn now<I: Io>() -> std::time::Duration {
    unsafe { current_io::<I>().now() }
}