fix: speed percentage in title is now accurate

We now properly account for full speed being 59.97Hz not, 59Hz or 60Hz
This commit is contained in:
2022-03-22 10:39:42 -03:00
parent eff25a0ab2
commit 5dd69500ca
3 changed files with 23 additions and 20 deletions

View File

@@ -33,8 +33,8 @@ pub const FpsAverage = struct {
self.sample_count += 1;
}
pub fn calc(self: *const Self) u64 {
return self.total / self.sample_count;
pub fn calc(self: *const Self) f64 {
return @intToFloat(f64, std.time.ns_per_s) / (@intToFloat(f64, self.total) / @intToFloat(f64, self.sample_count));
}
fn reset(self: *Self, sample: u64) void {