Corrects typo in examples FrameCounter (#4725)

This commit is contained in:
cantudo 2023-11-19 23:42:25 +01:00 committed by GitHub
parent fd53ea90e6
commit a827c1818b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -342,11 +342,11 @@ impl FrameCounter {
fn update(&mut self) {
self.frame_count += 1;
let new_instant = web_time::Instant::now();
let elasped_secs = (new_instant - self.last_printed_instant).as_secs_f32();
if elasped_secs > 1.0 {
let elapsed_ms = elasped_secs * 1000.0;
let elapsed_secs = (new_instant - self.last_printed_instant).as_secs_f32();
if elapsed_secs > 1.0 {
let elapsed_ms = elapsed_secs * 1000.0;
let frame_time = elapsed_ms / self.frame_count as f32;
let fps = self.frame_count as f32 / elasped_secs;
let fps = self.frame_count as f32 / elapsed_secs;
log::info!("Frame time {:.2}ms ({:.1} FPS)", frame_time, fps);
self.last_printed_instant = new_instant;