Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions crates/bevy_core/src/time/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,15 +469,18 @@ mod tests {
#[test]
fn times_finished_precise() {
let mut t = Timer::from_seconds(0.01, true);
let duration = Duration::from_secs_f64(1.0 / 3.0);
let duration = Duration::from_secs_f64(0.333);

// total duration: 0.333 => 33 times finished
t.tick(duration);
assert_eq!(t.times_finished(), 33);
// total duration: 0.666 => 33 times finished
t.tick(duration);
assert_eq!(t.times_finished(), 33);
// total duration: 0.999 => 33 times finished
t.tick(duration);
assert_eq!(t.times_finished(), 33);
// It has one additional tick this time to compensate for missing 100th tick
// total duration: 1.332 => 34 times finished
t.tick(duration);
assert_eq!(t.times_finished(), 34);
}
Expand Down