in src/replay.rs [292:313]
fn delay(&mut self, ts: u64) {
// handle new timestamp in log
if ts > self.ts_sec {
let mut now = Instant::now();
// info!("ts: {} sent: {} skip: {}", ts, sent, skip);
if self.ts_sec != 0 {
let log_dur = Duration::from_nanos(
(((ts - self.ts_sec) * 1_000_000_000) as f64 / self.speed) as u64,
);
self.next += log_dur;
if now > self.next {
warn!("falling behind... try reducing replay rate");
}
}
self.ts_sec = ts;
// delay if needed
while now < self.next {
std::thread::sleep(core::time::Duration::from_micros(100));
now = Instant::now();
}
}
}