lotus_script/
time.rs

1/// Get the current delta time in seconds.
2pub fn delta() -> f32 {
3    unsafe { lotus_script_sys::time::delta_f64() as f32 }
4}
5
6/// Get the current delta time in seconds.
7pub fn delta_f64() -> f64 {
8    unsafe { lotus_script_sys::time::delta_f64() }
9}
10
11/// Get the number of ticks the script has been alive.
12pub fn ticks_alive() -> u64 {
13    unsafe { lotus_script_sys::time::ticks_alive() }
14}
15
16/// Get the current in-game time.
17#[cfg(feature = "time")]
18pub fn game_time() -> lotus_shared::time::GameTime {
19    let unix_micros = unsafe { lotus_script_sys::time::game_time() };
20    lotus_shared::time::GameTime::from_unix_micros(unix_micros)
21}