Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 254381e

Browse files
authored
Bump chrono to v0.4.23 (#29709)
* Bump chrono to v0.4.23 * fmt...
1 parent 29ed19c commit 254381e

File tree

7 files changed

+21
-17
lines changed

7 files changed

+21
-17
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli-output/src/cli_output.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2412,7 +2412,11 @@ impl fmt::Display for CliBlock {
24122412
self.encoded_confirmed_block.previous_blockhash
24132413
)?;
24142414
if let Some(block_time) = self.encoded_confirmed_block.block_time {
2415-
writeln!(f, "Block Time: {:?}", Local.timestamp(block_time, 0))?;
2415+
writeln!(
2416+
f,
2417+
"Block Time: {:?}",
2418+
Local.timestamp_opt(block_time, 0).unwrap()
2419+
)?;
24162420
}
24172421
if let Some(block_height) = self.encoded_confirmed_block.block_height {
24182422
writeln!(f, "Block Height: {block_height:?}")?;

cli-output/src/display.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ fn write_block_time<W: io::Write>(
322322
) -> io::Result<()> {
323323
if let Some(block_time) = block_time {
324324
let block_time_output = match timezone {
325-
CliTimezone::Local => format!("{:?}", Local.timestamp(block_time, 0)),
326-
CliTimezone::Utc => format!("{:?}", Utc.timestamp(block_time, 0)),
325+
CliTimezone::Local => format!("{:?}", Local.timestamp_opt(block_time, 0).unwrap()),
326+
CliTimezone::Utc => format!("{:?}", Utc.timestamp_opt(block_time, 0).unwrap()),
327327
};
328328
writeln!(w, "{prefix}Block Time: {block_time_output}",)?;
329329
}

install/src/command.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,9 @@ fn release_channel_version_url(release_channel: &str) -> String {
596596
}
597597

598598
fn print_update_manifest(update_manifest: &UpdateManifest) {
599-
let when = Local.timestamp(update_manifest.timestamp_secs as i64, 0);
599+
let when = Local
600+
.timestamp_opt(update_manifest.timestamp_secs as i64, 0)
601+
.unwrap();
600602
println_name_value(&format!("{BULLET}release date:"), &when.to_string());
601603
println_name_value(
602604
&format!("{BULLET}download URL:"),

programs/config/src/date_instruction.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use bincode::{deserialize, serialized_size};
55
use {
66
crate::{config_instruction, ConfigState},
77
chrono::{
8-
prelude::{Date, DateTime, TimeZone, Utc},
8+
prelude::{DateTime, TimeZone, Utc},
99
serde::ts_seconds,
1010
},
1111
serde_derive::{Deserialize, Serialize},
@@ -21,15 +21,13 @@ pub struct DateConfig {
2121
impl Default for DateConfig {
2222
fn default() -> Self {
2323
Self {
24-
date_time: Utc.timestamp(0, 0),
24+
date_time: Utc.timestamp_opt(0, 0).unwrap(),
2525
}
2626
}
2727
}
2828
impl DateConfig {
29-
pub fn new(date: Date<Utc>) -> Self {
30-
Self {
31-
date_time: date.and_hms(0, 0, 0),
32-
}
29+
pub fn new(date_time: DateTime<Utc>) -> Self {
30+
Self { date_time }
3331
}
3432

3533
pub fn deserialize(input: &[u8]) -> Option<Self> {
@@ -54,7 +52,7 @@ pub fn create_account(
5452

5553
/// Set the date in the date account. The account pubkey must be signed in the
5654
/// transaction containing this instruction.
57-
pub fn store(date_pubkey: &Pubkey, date: Date<Utc>) -> Instruction {
58-
let date_config = DateConfig::new(date);
55+
pub fn store(date_pubkey: &Pubkey, date_time: DateTime<Utc>) -> Instruction {
56+
let date_config = DateConfig::new(date_time);
5957
config_instruction::store(date_pubkey, true, vec![], &date_config)
6058
}

tokens/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ homepage = "https://solana.com/"
1010
documentation = "https://docs.rs/solana-tokens"
1111

1212
[dependencies]
13-
chrono = { version = "0.4", features = ["serde"] }
13+
chrono = { version = "0.4.23", features = ["serde"] }
1414
clap = "2.33.0"
1515
console = "0.15.0"
1616
csv = "1.1.6"

tokens/src/db.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,11 @@ mod tests {
218218
#[test]
219219
fn test_sort_transaction_infos_finalized_first() {
220220
let info0 = TransactionInfo {
221-
finalized_date: Some(Utc.ymd(2014, 7, 8).and_hms(9, 10, 11)),
221+
finalized_date: Some(Utc.with_ymd_and_hms(2014, 7, 8, 9, 10, 11).unwrap()),
222222
..TransactionInfo::default()
223223
};
224224
let info1 = TransactionInfo {
225-
finalized_date: Some(Utc.ymd(2014, 7, 8).and_hms(9, 10, 42)),
225+
finalized_date: Some(Utc.with_ymd_and_hms(2014, 7, 8, 9, 10, 42).unwrap()),
226226
..TransactionInfo::default()
227227
};
228228
let info2 = TransactionInfo::default();

0 commit comments

Comments
 (0)