diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2022-10-28 18:36:07 +0200 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2022-10-28 18:36:07 +0200 |
commit | 015d76316a06dbead33b81f57fd3126591d180c7 (patch) | |
tree | c4f9aa15e236aff76b5eac9ded55ec74823c562e | |
parent | a124f6d56f1b50bb1ef8532feed5eaca443f45b1 (diff) |
parse interval durations properly
-rw-r--r-- | src/main.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs index 41de5f2..ef2eef1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -109,8 +109,8 @@ struct Config { prefix_len: u8, link4: String, link6: String, - interval4: Duration, - interval6: Duration, + interval4: u64, + interval6: u64, } fn main() -> Result<()> { @@ -134,7 +134,7 @@ fn main() -> Result<()> { Err(e) => println!("failed to push ipv4 address: {}", e), } - thread::sleep(config0.interval4); + thread::sleep(Duration::from_secs(config0.interval4)); } }); let push6_thread = thread::spawn(move || { @@ -144,7 +144,7 @@ fn main() -> Result<()> { Err(e) => println!("failed to push ipv6 prefix: {}", e), } - thread::sleep(config1.interval6); + thread::sleep(Duration::from_secs(config1.interval6)); } }); @@ -155,7 +155,7 @@ fn main() -> Result<()> { Err(e) => println!("failed to monitor ipv4 address: {}", e), } - thread::sleep(config2.interval4); + thread::sleep(Duration::from_secs(config2.interval4)); } }); let monitor6_thread = thread::spawn(move || { @@ -165,7 +165,7 @@ fn main() -> Result<()> { Err(e) => println!("failed to monitor ipv6 prefix: {}", e), } - thread::sleep(config3.interval6); + thread::sleep(Duration::from_secs(config3.interval6)); } }); @@ -189,7 +189,7 @@ fn monitor4(config: Arc<Config>, tx: mpsc::Sender<Ipv4Addr>) -> Result<()> { ipv4 = Some(new_ipv4); } - thread::sleep(config.interval4); + thread::sleep(Duration::from_secs(config.interval4)); } } @@ -204,7 +204,7 @@ fn monitor6(config: Arc<Config>, tx: mpsc::Sender<Ipv6Net>) -> Result<()> { ipv6 = Some(new_ipv6); } - thread::sleep(config.interval6); + thread::sleep(Duration::from_secs(config.interval6)); } } |