very slightly improve frame timings when not quite reaching 60 fps

This commit is contained in:
2022-07-14 00:05:15 +02:00
parent 539d19e0d7
commit 7ec1e68a00

View File

@@ -223,7 +223,9 @@ impl State {
let time = (now - instance.start_time).as_millis() as i32;
{
let offset = ((time as u32 as i64 * 6) % 100 - 50) / 6;
result = Ok(now + Duration::from_millis((16 - offset) as u64));
let max = now + Duration::from_millis(17);
let next_center = now + Duration::from_millis((16 - offset) as u64);
result = Ok(next_center.min(max));
}
{