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/util/mod.rs | 1 - cli/util/time.rs | 19 ------------------- 2 files changed, 20 deletions(-) delete mode 100644 cli/util/time.rs (limited to 'cli/util') diff --git a/cli/util/mod.rs b/cli/util/mod.rs index c8155dc51..89df7bb98 100644 --- a/cli/util/mod.rs +++ b/cli/util/mod.rs @@ -15,7 +15,6 @@ pub mod progress_bar; pub mod result; pub mod sync; pub mod text_encoding; -pub mod time; pub mod unix; pub mod v8; pub mod windows; diff --git a/cli/util/time.rs b/cli/util/time.rs deleted file mode 100644 index 47306c126..000000000 --- a/cli/util/time.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. - -/// Identical to chrono::Utc::now() but without the system "clock" -/// feature flag. -/// -/// The "clock" feature flag pulls in the "iana-time-zone" crate -/// which links to macOS's "CoreFoundation" framework which increases -/// startup time for the CLI. -/// -/// You can simply include this file in your project using -/// `include!("path/to/cli/util/time.rs"))` and use it -/// as a drop-in replacement for chrono::Utc::now(). -pub fn utc_now() -> chrono::DateTime { - let now = std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .expect("system time before Unix epoch"); - chrono::DateTime::from_timestamp(now.as_secs() as i64, now.subsec_nanos()) - .unwrap() -} -- cgit v1.2.3