From fa1ba256d20236042455abb31a92d2a1d27ee58f Mon Sep 17 00:00:00 2001 From: Felipe Baltor Date: Thu, 23 May 2024 08:59:11 -0300 Subject: refactor: remove custom `utc_now` in favor of `chrono::Utc:now` feature (#23888) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR removes the use of the custom `utc_now` function in favor of the `chrono` implementation. It resolves #22864. --------- Co-authored-by: Bartek IwaƄczuk --- cli/tools/coverage/reporter.rs | 2 +- cli/tools/upgrade.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'cli/tools') diff --git a/cli/tools/coverage/reporter.rs b/cli/tools/coverage/reporter.rs index f359755a9..4bb72b264 100644 --- a/cli/tools/coverage/reporter.rs +++ b/cli/tools/coverage/reporter.rs @@ -399,7 +399,7 @@ impl CoverageReporter for HtmlCoverageReporter { fn done(&mut self, coverage_root: &Path) { let summary = self.collect_summary(&self.file_reports); - let now = crate::util::time::utc_now().to_rfc2822(); + let now = chrono::Utc::now().to_rfc2822(); for (node, stats) in &summary { let report_path = diff --git a/cli/tools/upgrade.rs b/cli/tools/upgrade.rs index 073ebdc1c..8379c6fd2 100644 --- a/cli/tools/upgrade.rs +++ b/cli/tools/upgrade.rs @@ -10,7 +10,6 @@ use crate::http_util::HttpClient; use crate::standalone::binary::unpack_into_dir; use crate::util::progress_bar::ProgressBar; use crate::util::progress_bar::ProgressBarStyle; -use crate::util::time; use crate::version; use async_trait::async_trait; @@ -60,7 +59,7 @@ impl RealUpdateCheckerEnvironment { Self { cache_file_path, // cache the current time - current_time: time::utc_now(), + current_time: chrono::Utc::now(), } } } @@ -785,7 +784,7 @@ mod test { current_version: Default::default(), is_canary: Default::default(), latest_version: Rc::new(RefCell::new(Ok("".to_string()))), - time: Rc::new(RefCell::new(crate::util::time::utc_now())), + time: Rc::new(RefCell::new(chrono::Utc::now())), } } -- cgit v1.2.3