1212
1313use bevy_app:: FixedUpdate ;
1414use bevy_ecs:: { system:: Resource , world:: World } ;
15- use bevy_utils:: { default, Duration , Instant } ;
15+ use bevy_utils:: { default, Duration } ;
1616
1717use crate :: { Time , TimeContext } ;
1818
@@ -28,7 +28,7 @@ pub struct FixedTimestep {
2828impl Default for FixedTimestep {
2929 fn default ( ) -> Self {
3030 Self {
31- size : Duration :: from_micros ( 15625 ) ,
31+ size : Self :: DEFAULT_STEP_SIZE ,
3232 steps : 0 ,
3333 overstep : Duration :: ZERO ,
3434 max_steps_per_update : u32:: MAX ,
@@ -37,6 +37,9 @@ impl Default for FixedTimestep {
3737}
3838
3939impl FixedTimestep {
40+ /// The default step size.
41+ pub const DEFAULT_STEP_SIZE : Duration = Duration :: from_micros ( 15625 ) ;
42+
4043 /// Constructs a new `FixedTimestep` from a [`Duration`].
4144 pub fn new ( size : Duration ) -> Self {
4245 assert ! ( !size. is_zero( ) , "timestep is zero" ) ;
@@ -139,11 +142,10 @@ pub fn run_fixed_update_schedule(world: &mut World) {
139142 }
140143
141144 // run schedule however many times
142- let dt = timestep. size ( ) ;
143145 for _ in 0 ..steps {
144146 let mut time = world. resource_mut :: < Time > ( ) ;
145147 assert ! ( matches!( time. context( ) , TimeContext :: FixedUpdate ) ) ;
146- time. tick ( dt , Instant :: now ( ) ) ;
148+ time. update ( ) ;
147149 schedule. run ( world) ;
148150 }
149151
0 commit comments