Skip to content

Commit 0720e62

Browse files
Time<Real> documentation improvement (#15874)
# Objective Fixes #15445 ## Solution Add a note to the doc comment for `Real`. ## Testing Viewed the built documentation. ## Showcase ![image](https://github.com/user-attachments/assets/815b8655-c632-4c92-b64e-28c06959c38b) [*possible bug in rustdoc rendering the footnote](rust-lang/rust#131631)
1 parent 37501e1 commit 0720e62

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

crates/bevy_time/src/real.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ use crate::time::Time;
1111
///
1212
/// It is automatically inserted as a resource by
1313
/// [`TimePlugin`](crate::TimePlugin) and updated with time instants according
14-
/// to [`TimeUpdateStrategy`](crate::TimeUpdateStrategy).
14+
/// to [`TimeUpdateStrategy`](crate::TimeUpdateStrategy).[^disclaimer]
15+
///
16+
/// Note:
17+
/// Using [`TimeUpdateStrategy::ManualDuration`](crate::TimeUpdateStrategy::ManualDuration)
18+
/// allows for mocking the wall clock for testing purposes.
19+
/// Besides this use case, it is not recommended to do this, as it will no longer
20+
/// represent "wall clock" time as intended.
1521
///
1622
/// The [`delta()`](Time::delta) and [`elapsed()`](Time::elapsed) values of this
1723
/// clock should be used for anything which deals specifically with real time
1824
/// (wall clock time). It will not be affected by relative game speed
19-
/// adjustments, pausing or other adjustments.
25+
/// adjustments, pausing or other adjustments.[^disclaimer]
2026
///
2127
/// The clock does not count time from [`startup()`](Time::startup) to
2228
/// [`first_update()`](Time::first_update()) into elapsed, but instead will
@@ -29,6 +35,10 @@ use crate::time::Time;
2935
/// [`Instant`]s for [`startup()`](Time::startup),
3036
/// [`first_update()`](Time::first_update) and
3137
/// [`last_update()`](Time::last_update) are recorded and accessible.
38+
///
39+
/// [^disclaimer]: When using [`TimeUpdateStrategy::ManualDuration`](crate::TimeUpdateStrategy::ManualDuration),
40+
/// [`Time<Real>#impl-Time<Real>`] is only a *mock* of wall clock time.
41+
///
3242
#[derive(Debug, Copy, Clone)]
3343
#[cfg_attr(feature = "bevy_reflect", derive(Reflect))]
3444
pub struct Real {

0 commit comments

Comments
 (0)