From 389208d1da71536bcfefe1d1d51cc968d823bbf5 Mon Sep 17 00:00:00 2001 From: aggstam Date: Mon, 9 May 2022 17:56:50 +0300 Subject: [PATCH] script/research/clock_sync: minor cleanup --- script/research/clock_sync/src/main.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/script/research/clock_sync/src/main.rs b/script/research/clock_sync/src/main.rs index 4b8071947..db13b7f7b 100644 --- a/script/research/clock_sync/src/main.rs +++ b/script/research/clock_sync/src/main.rs @@ -55,15 +55,15 @@ async fn check_clock() -> ClockResult<()> { debug!("System clock check started..."); let mut r = 0; while r < RETRIES { - let check = clock_check().await; - match check { - Ok(()) => break, - Err(e) => error!("Error during clock check: {}", e), - } - r += 1; + if let Err(e) = clock_check().await { + error!("Error during clock check: {}", e); + r += 1; + continue + }; + break } - debug!("System clock check finished. Retries: {}", r); + debug!("System clock check finished. Retries: {}", r); match r { RETRIES => Err(ClockError::InvalidClock), _ => Ok(()), @@ -102,7 +102,7 @@ async fn clock_check() -> ClockResult<()> { debug!("ntp_time: {}", ntp_time); debug!("system_time: {}", system_time); - // We verify that system time is equal to worldtimeapi or ntp + // We verify that system time is equal to worldtimeapi and ntp let check = (system_time == worldtimeapi_time) && (system_time == ntp_time); match check { true => Ok(()),