diff --git a/Cargo.lock b/Cargo.lock index 1ba69acd0787f5..7e0d167478637f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1277,9 +1277,9 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "chrono" -version = "0.4.34" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" +checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" dependencies = [ "android-tzdata", "iana-time-zone", diff --git a/Cargo.toml b/Cargo.toml index 0f85ef090cfbc1..581ee2efeec769 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -173,7 +173,7 @@ bzip2 = "0.4.4" caps = "0.5.5" cargo_metadata = "0.15.4" cc = "1.0.83" -chrono = { version = "0.4.34", default-features = false } +chrono = { version = "0.4.37", default-features = false } chrono-humanize = "0.2.3" clap = "2.33.1" console = "0.15.8" diff --git a/cli-output/src/display.rs b/cli-output/src/display.rs index c3465e493b7cf1..e68d51b480dbe5 100644 --- a/cli-output/src/display.rs +++ b/cli-output/src/display.rs @@ -1,7 +1,7 @@ use { crate::cli_output::CliSignatureVerificationStatus, base64::{prelude::BASE64_STANDARD, Engine}, - chrono::{Local, NaiveDateTime, SecondsFormat, TimeZone, Utc}, + chrono::{DateTime, Local, SecondsFormat, TimeZone, Utc}, console::style, indicatif::{ProgressBar, ProgressStyle}, solana_cli_config::SettingType, @@ -715,10 +715,8 @@ pub fn new_spinner_progress_bar() -> ProgressBar { } pub fn unix_timestamp_to_string(unix_timestamp: UnixTimestamp) -> String { - match NaiveDateTime::from_timestamp_opt(unix_timestamp, 0) { - Some(ndt) => Utc - .from_utc_datetime(&ndt) - .to_rfc3339_opts(SecondsFormat::Secs, true), + match DateTime::from_timestamp(unix_timestamp, 0) { + Some(ndt) => ndt.to_rfc3339_opts(SecondsFormat::Secs, true), None => format!("UnixTimestamp {unix_timestamp}"), } } @@ -976,4 +974,9 @@ Rewards: "abcdefghijklmnopqrstuvwxyz12345 (1111..1111)" ); } + + #[test] + fn test_unix_timestamp_to_string() { + assert_eq!(unix_timestamp_to_string(1628633791), "2021-08-10T22:16:31Z"); + } } diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index f3279c33612893..417e8a388ecea6 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -1015,9 +1015,9 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "chrono" -version = "0.4.34" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" +checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" dependencies = [ "android-tzdata", "iana-time-zone",