@@ -33,17 +33,23 @@ impl Default for CoordinateTime {
33
33
}
34
34
35
35
impl CoordinateTime {
36
+ /// The current epoch (starting epoch + elapsed system time)
36
37
pub fn epoch ( & self ) -> Epoch {
37
38
self . start_epoch
38
39
. unwrap_or_else ( || Epoch :: from_duration ( Duration :: ZERO , self . scale ) )
39
40
+ self . elapsed
40
41
}
41
42
43
+ /// The current epoch, represented in some other timescale. Might be useless
44
+ #[ allow( dead_code) ]
42
45
pub fn epoch_in_scale ( & self , time_scale : TimeScale ) -> Epoch {
43
46
let native_epoch = self . start_epoch . unwrap_or_default ( ) + self . elapsed ;
44
47
native_epoch. in_time_scale ( time_scale)
45
48
}
46
49
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.
47
53
pub fn elapsed_seconds ( & self ) -> f64 {
48
54
self . elapsed . to_seconds ( )
49
55
}
@@ -67,7 +73,11 @@ impl fmt::Debug for CoordinateTime {
67
73
}
68
74
}
69
75
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.
71
81
fn sync_coordinate_time (
72
82
physics_time : Res < Time < Physics > > ,
73
83
mut coordinate_time : ResMut < CoordinateTime > ,
0 commit comments