tempest_rt/time.rs
1use tempest_io::Io;
2
3use crate::context::current_io;
4
5/// Retrieves the current duration since the epoch start start from I/O.
6/// The type parameter `I` must match the [`Io`] implementation this runtime was initialized with.
7///
8/// # Panics
9///
10/// Panics if called outside of an active runtime or if `I` does not match the runtime's I/O type.
11pub fn now<I: Io>() -> std::time::Duration {
12 unsafe { current_io::<I>().now() }
13}