ratecontroller: use durations instead of manually handling time

This commit is contained in:
Nils Andreas Svee committed 2022-11-10 13:54:26 +01:00
1 parent bb9d1ed4af
commit 5c0a6c304f
7 files changed
+84 -67

No files matched your search

+2 -2
View File
@@ -1,4 +1,5 @@
use std::net::IpAddr;
use std::time::Instant;
use crate::pinger::{PingError, PingListener, PingReply, PingSender};
use crate::time::Time;
@@ -46,8 +47,7 @@ impl PingListener for PingerICMPEchoListener {
originate_timestamp: 0,
receive_timestamp: 0,
transmit_timestamp: 0,
last_receive_time_s: clock.get_seconds() as f64
+ (clock.get_nanoseconds() as f64 / 1e9),
last_receive_time_s: Instant::now(),
})
}
type_ => Err(PingError::InvalidType(format!("{:?}", type_))),