Skip to content

Instantly share code, notes, and snippets.

@saethlin
Created June 13, 2021 21:07
Show Gist options
  • Select an option

  • Save saethlin/3972fc7222e8552890f5003e4b90c382 to your computer and use it in GitHub Desktop.

Select an option

Save saethlin/3972fc7222e8552890f5003e4b90c382 to your computer and use it in GitHub Desktop.
Does the PACKET_MMAP clock go backwards?
let mut cap = packet_capture::Capture::new("enp68s0").unwrap();
let mut previous_time = (0, 0);
loop {
let packet = cap.next();
let time = (packet.tp_sec, packet.tp_nsec);
if time < previous_time {
println!("{:?}: {:?} {:?}", chrono::Local::now(), time, previous_time);
} else {
previous_time = time;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment