Skip to content

Commit

Permalink
chore: fix deprecated warnings for chrono
Browse files Browse the repository at this point in the history
  • Loading branch information
godzie44 committed Oct 2, 2024
1 parent c0a2ccb commit 70cff26
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/debugger/variable/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl RenderValue for Value {
ValueLayout::PreRendered(Cow::Owned(uuid.to_string()))
}
SpecializedValue::SystemTime((sec, n_sec)) => {
let mb_dt = chrono::NaiveDateTime::from_timestamp_opt(*sec, *n_sec);
let mb_dt = chrono::DateTime::from_timestamp(*sec, *n_sec);
let dt_rendered = mb_dt
.map(|dt| dt.format("%Y-%m-%d %H:%M:%S").to_string())
.unwrap_or("Broken date time".to_string());
Expand Down
5 changes: 2 additions & 3 deletions src/debugger/variable/value/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ impl Value {
Some(Literal::String(uuid.to_string()))
}
SpecializedValue::SystemTime(time) => {
let time = chrono::NaiveDateTime::from_timestamp_opt(time.0, time.1)?;
let time = chrono::DateTime::from_timestamp(time.0, time.1)?;
Some(Literal::String(
time.format("%Y-%m-%d %H:%M:%S").to_string(),
))
Expand Down Expand Up @@ -927,8 +927,7 @@ impl Value {
.map(|v| v.match_literal(literal))
.unwrap_or_default(),
SpecializedValue::SystemTime(time) => {
let Some(time) = chrono::NaiveDateTime::from_timestamp_opt(time.0, time.1)
else {
let Some(time) = chrono::DateTime::from_timestamp(time.0, time.1) else {
return false;
};

Expand Down

0 comments on commit 70cff26

Please sign in to comment.