diff --git a/Cargo.lock b/Cargo.lock index ca24362826..782922d887 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -999,10 +999,8 @@ checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", - "js-sys", "num-traits", "serde", - "wasm-bindgen", "windows-targets 0.52.5", ] @@ -2366,7 +2364,6 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" name = "explorer-api" version = "1.1.41" dependencies = [ - "chrono", "clap 4.5.20", "dotenvy", "humantime-serde", @@ -2394,6 +2391,7 @@ dependencies = [ "serde", "serde_json", "thiserror", + "time", "tokio", ] @@ -5099,7 +5097,6 @@ version = "0.1.0" dependencies = [ "anyhow", "axum 0.7.7", - "chrono", "clap 4.5.20", "nym-bin-common", "nym-network-defaults", @@ -5108,6 +5105,7 @@ dependencies = [ "serde", "serde_json", "sqlx", + "time", "tokio", "tokio-util", "tower-http", @@ -6564,7 +6562,6 @@ version = "0.1.0" dependencies = [ "base64 0.22.1", "bincode", - "chrono", "dashmap", "defguard_wireguard_rs", "futures", @@ -6578,6 +6575,7 @@ dependencies = [ "nym-task", "nym-wireguard-types", "thiserror", + "time", "tokio", "tokio-stream", "x25519-dalek", diff --git a/Cargo.toml b/Cargo.toml index ee9b482356..db36b3095a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -206,7 +206,6 @@ celes = "2.4.0" cfg-if = "1.0.0" chacha20 = "0.9.0" chacha20poly1305 = "0.10.1" -chrono = "0.4.31" cipher = "0.4.3" clap = "4.5.20" clap_complete = "4.5" diff --git a/common/wireguard/Cargo.toml b/common/wireguard/Cargo.toml index f20651acbd..cd45610ff6 100644 --- a/common/wireguard/Cargo.toml +++ b/common/wireguard/Cargo.toml @@ -13,7 +13,7 @@ license.workspace = true [dependencies] base64 = { workspace = true } bincode = { workspace = true } -chrono = { workspace = true } +time = { workspace = true } dashmap = { workspace = true } defguard_wireguard_rs = { workspace = true } futures = { workspace = true } diff --git a/explorer-api/Cargo.toml b/explorer-api/Cargo.toml index 8e59935476..b5437534a3 100644 --- a/explorer-api/Cargo.toml +++ b/explorer-api/Cargo.toml @@ -7,7 +7,8 @@ license.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -chrono = { workspace = true, features = ["serde"] } +# chrono = { workspace = true, features = ["serde"] } +time = { workspace = true } clap = { workspace = true, features = ["cargo", "derive"] } dotenvy = { workspace = true } humantime-serde = { workspace = true } diff --git a/explorer-api/src/state.rs b/explorer-api/src/state.rs index b007fae76d..92b4210e05 100644 --- a/explorer-api/src/state.rs +++ b/explorer-api/src/state.rs @@ -1,10 +1,10 @@ use std::fs::File; use std::path::Path; -use chrono::{DateTime, Utc}; use log::info; use nym_mixnet_contract_common::NodeId; use serde::{Deserialize, Serialize}; +use time::OffsetDateTime; use crate::client::ThreadsafeValidatorClient; use crate::geo_ip::location::ThreadsafeGeoIp; @@ -49,7 +49,7 @@ pub struct ExplorerApiStateOnDisk { pub(crate) country_node_distribution: CountryNodesDistribution, pub(crate) mixnode_location_cache: MixnodeLocationCache, pub(crate) gateway_location_cache: GatewayLocationCache, - pub(crate) as_at: DateTime, + pub(crate) as_at: OffsetDateTime, } #[derive(Clone)] @@ -117,7 +117,7 @@ impl ExplorerApiStateContext { country_node_distribution: self.inner.country_node_distribution.get_all().await, mixnode_location_cache: self.inner.mixnodes.get_locations().await, gateway_location_cache: self.inner.gateways.get_locations().await, - as_at: Utc::now(), + as_at: OffsetDateTime::now_utc(), }; serde_json::to_writer(file, &state).expect("error writing state to disk"); info!("Saved file to '{:?}'", json_file_path.canonicalize()); diff --git a/nym-data-observatory/Cargo.toml b/nym-data-observatory/Cargo.toml index 220449bfb1..ba9a6b75a1 100644 --- a/nym-data-observatory/Cargo.toml +++ b/nym-data-observatory/Cargo.toml @@ -16,7 +16,7 @@ readme.workspace = true [dependencies] anyhow = { workspace = true } axum = { workspace = true, features = ["tokio"] } -chrono = { workspace = true } +time = { workspace = true } clap = { workspace = true, features = ["derive", "env"] } nym-bin-common = { path = "../common/bin-common" } nym-network-defaults = { path = "../common/network-defaults" } diff --git a/nym-data-observatory/src/db/models.rs b/nym-data-observatory/src/db/models.rs index e1e9682235..4449b78037 100644 --- a/nym-data-observatory/src/db/models.rs +++ b/nym-data-observatory/src/db/models.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; +use time::OffsetDateTime; use utoipa::ToSchema; use crate::background_task::Response; @@ -16,7 +17,7 @@ impl From for JokeDto { joke_id: value.joke_id, joke: value.joke, // casting not smart, can implicitly panic, don't do this in prod - date_created: chrono::offset::Utc::now().timestamp() as i32, + date_created: OffsetDateTime::now_utc().unix_timestamp() as i32, } } }