diff --git a/crates/bevy_time/src/stopwatch.rs b/crates/bevy_time/src/stopwatch.rs index cb9bd953f0e9f..bb92bd25868c8 100644 --- a/crates/bevy_time/src/stopwatch.rs +++ b/crates/bevy_time/src/stopwatch.rs @@ -58,7 +58,8 @@ impl Stopwatch { /// /// # See Also /// - /// [`elapsed_secs`](Stopwatch::elapsed) - if a `f32` value is desirable instead. + /// [`elapsed_secs`](Stopwatch::elapsed_secs) - if a `f32` value is desirable instead. + /// [`elapsed_secs_f64`](Stopwatch::elapsed_secs_f64) - if a `f64` is desirable instead. #[inline] pub fn elapsed(&self) -> Duration { self.elapsed @@ -79,11 +80,24 @@ impl Stopwatch { /// # See Also /// /// [`elapsed`](Stopwatch::elapsed) - if a `Duration` is desirable instead. + /// [`elapsed_secs_f64`](Stopwatch::elapsed_secs_f64) - if a `f64` is desirable instead. #[inline] pub fn elapsed_secs(&self) -> f32 { self.elapsed().as_secs_f32() } + /// Returns the elapsed time since the last [`reset`](Stopwatch::reset) + /// of the stopwatch, in seconds, as f64. + /// + /// # See Also + /// + /// [`elapsed`](Stopwatch::elapsed) - if a `Duration` is desirable instead. + /// [`elapsed_secs`](Stopwatch::elapsed_secs) - if a `f32` is desirable instead. + #[inline] + pub fn elapsed_secs_f64(&self) -> f64 { + self.elapsed().as_secs_f64() + } + /// Sets the elapsed time of the stopwatch. /// /// # Examples