ratecontroller: no need to manually construct duration

This commit is contained in:
Nils Andreas Svee committed 2022-10-18 16:22:15 +02:00
1 parent d2e0d2b0be
commit 1c38d8ff48
1 file changed
+1 -3
+1 -3
View File
@@ -277,9 +277,7 @@ impl Ratecontroller {
down_direction: StatsDirection, down_direction: StatsDirection,
up_direction: StatsDirection, up_direction: StatsDirection,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
let sleep_time_s = self.config.min_change_interval.floor() as u64; let sleep_time = Duration::from_secs_f64(self.config.min_change_interval);
let sleep_time_ns = ((self.config.min_change_interval % 1.0) * 1e9) as u32;
let sleep_time = Duration::new(sleep_time_s, sleep_time_ns);
let time = Clock::new(ClockId::Monotonic); let time = Clock::new(ClockId::Monotonic);
let start_s = time.get_seconds() as f64; let start_s = time.get_seconds() as f64;