diff --git a/crates/bevy_core/src/time/time.rs b/crates/bevy_core/src/time/time.rs index dd75fc818d..0995d60c79 100644 --- a/crates/bevy_core/src/time/time.rs +++ b/crates/bevy_core/src/time/time.rs @@ -29,11 +29,66 @@ impl Default for Time { impl Time { /// Updates the internal time measurements. + /// + /// Calling this method on the [`Time`] resource as part of your app will most likely result in + /// inaccurate timekeeping, as the resource is ordinarily managed by the + /// [`CorePlugin`](crate::CorePlugin). pub fn update(&mut self) { self.update_with_instant(Instant::now()); } - pub(crate) fn update_with_instant(&mut self, instant: Instant) { + /// Update time with a specified [`Instant`] + /// + /// This method is provided for use in tests. Calling this method on the [`Time`] resource as + /// part of your app will most likely result in inaccurate timekeeping, as the resource is + /// ordinarily managed by the [`CorePlugin`](crate::CorePlugin). + /// + /// # Examples + /// + /// ``` + /// # use bevy_core::prelude::*; + /// # use bevy_ecs::prelude::*; + /// # use bevy_utils::Duration; + /// # fn main () { + /// # test_health_system(); + /// # } + /// struct Health { + /// // Health value between 0.0 and 1.0 + /// health_value: f32, + /// } + /// + /// fn health_system(time: Res