Minor refactor.

This commit is contained in:
Stephen Chung
2022-03-09 09:25:55 +08:00
parent 89426f8b3a
commit 1e4abd012c
11 changed files with 86 additions and 74 deletions

View File

@@ -31,6 +31,16 @@ mod time_functions {
}
/// Return the number of seconds between the current system time and the timestamp.
///
/// # Example
///
/// ```rhai
/// let now = timestamp();
///
/// sleep(10.0); // sleep for 10 seconds
///
/// print(now.elapsed); // prints 10.???
/// ```
#[rhai_fn(name = "elapsed", get = "elapsed", return_raw)]
pub fn elapsed(timestamp: Instant) -> RhaiResult {
#[cfg(not(feature = "no_float"))]