From c124f9fff690a42ea5fb490e4c7e512ba8448951 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Thu, 13 Jun 2024 16:54:35 +0200 Subject: cargo update + `time` update, fix for `Instant` deprecation --- src/services/ping.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/services') diff --git a/src/services/ping.rs b/src/services/ping.rs index 4e0ffcf..69c911f 100644 --- a/src/services/ping.rs +++ b/src/services/ping.rs @@ -2,8 +2,8 @@ use crate::config::Config; use crate::storage::Device; use dashmap::DashMap; use ipnetwork::IpNetwork; -use std::fmt::Display; -use time::{Duration, Instant}; +use std::{fmt::Display, time::Instant}; +use time::Duration; use tokio::sync::broadcast::Sender; use tracing::{debug, error, trace}; @@ -12,7 +12,7 @@ pub type StatusMap = DashMap; #[derive(Debug, Clone)] pub struct Value { pub ip: IpNetwork, - pub eta: i64, + pub eta: u64, pub online: bool, } @@ -56,12 +56,12 @@ pub async fn spawn( let _ = tx.send(msg.clone()); if msg.command == BroadcastCommands::Success { - if timer.elapsed().whole_seconds() > config.pingthreshold { + if timer.elapsed().as_secs() > config.pingthreshold { let newtimes = if let Some(mut oldtimes) = device.times { - oldtimes.push(timer.elapsed().whole_seconds()); + oldtimes.push(timer.elapsed().as_secs()); oldtimes } else { - vec![timer.elapsed().whole_seconds()] + vec![timer.elapsed().as_secs()] }; let updatedev = Device { -- cgit v1.2.3