Skip to content

Commit bb60ed1

Browse files
committed
docs
1 parent 15eff60 commit bb60ed1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

spacetime/src/physics/time.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,23 @@ impl Default for CoordinateTime {
3333
}
3434

3535
impl CoordinateTime {
36+
/// The current epoch (starting epoch + elapsed system time)
3637
pub fn epoch(&self) -> Epoch {
3738
self.start_epoch
3839
.unwrap_or_else(|| Epoch::from_duration(Duration::ZERO, self.scale))
3940
+ self.elapsed
4041
}
4142

43+
/// The current epoch, represented in some other timescale. Might be useless
44+
#[allow(dead_code)]
4245
pub fn epoch_in_scale(&self, time_scale: TimeScale) -> Epoch {
4346
let native_epoch = self.start_epoch.unwrap_or_default() + self.elapsed;
4447
native_epoch.in_time_scale(time_scale)
4548
}
4649

50+
/// Number of seconds of system time that have elapsed since the start
51+
/// epoch. This is here for convenience for when we don't want to clutter
52+
/// code converting from hifitime::Durations.
4753
pub fn elapsed_seconds(&self) -> f64 {
4854
self.elapsed.to_seconds()
4955
}
@@ -67,7 +73,11 @@ impl fmt::Debug for CoordinateTime {
6773
}
6874
}
6975

70-
/// Avian Physics Time is used as the Coordinate Time
76+
/// Increment the elapsed coordinate time by adding the time since the last tick
77+
///
78+
/// Avian Physics Time is used as the Coordinate Time but this system runs every
79+
/// update. That means the actual time updates with the physics schedule, and
80+
/// the coordinate time resource is always as up to date as possible.
7181
fn sync_coordinate_time(
7282
physics_time: Res<Time<Physics>>,
7383
mut coordinate_time: ResMut<CoordinateTime>,

0 commit comments

Comments
 (0)