fn calculate_wait(
        current_elapsed: Duration,
        target_interval: Duration,
        current_lag: Duration,
    ) -> Duration {
        if current_elapsed >= target_interval {
            Duration::new(0, 0)
        } else {
            let delta = target_interval - current_elapsed;
            if current_lag > delta {
                Duration::new(0, 0)
            } else {
                delta - current_lag
            }
        }
    }
/// calculate a sleep duration after a loop iteration
calculate a sleep duration after a loop iteration
calculate a sleep duration after a loop iteration
fn calculate_wait(
        current_elapsed: Duration,
        target_interval: Duration,
        current_lag: Duration,
    ) -> Duration {
        if current_elapsed >= target_interval {
            Duration::new(0, 0)
        } else {
            let delta = target_interval - current_elapsed;
            if current_lag > delta {
                Duration::new(0, 0)
            } else {
                delta - current_lag
            }
        }
    }
fn calculate_wait ( current_elapsed : Duration , target_interval : Duration , current_lag : Duration , ) -> Duration { if current_elapsed >= target_interval { Duration :: new ( 0 , 0 ) } else { let delta = target_interval - current_elapsed ; if current_lag > delta { Duration :: new ( 0 , 0 ) } else { delta - current_lag } } }
calculate a sleep duration after a loop iteration
calculate a sleep duration after a loop iteration
current_elapsed
Duration
target_interval
Duration
current_lag
Duration