summaryrefslogtreecommitdiffstats
path: root/src/data_conversion.rs
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2021-10-17 21:33:07 -0400
committerGitHub <noreply@github.com>2021-10-17 21:33:07 -0400
commitea0c7b49b7f4f546f4c20997b6efeea253c8d078 (patch)
treee003782c49ac7d58328a7df90ff39e5e8ac613fd /src/data_conversion.rs
parent6c157fe1ddde267a44d2bd0577291e39435c31bd (diff)
deps: bump deps, remove chrono (#600)
Bumps up some dependencies and removes chrono, switching to the time crate instead. One of side-effects of this change is that local time seems to not work (?)... so all logs are now in UTC. Oh well, this doesn't affect general user behaviour so I'm fine with it.
Diffstat (limited to 'src/data_conversion.rs')
-rw-r--r--src/data_conversion.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/data_conversion.rs b/src/data_conversion.rs
index 7e4d214e..5aaa9f31 100644
--- a/src/data_conversion.rs
+++ b/src/data_conversion.rs
@@ -1375,13 +1375,13 @@ pub fn convert_battery_harvest(
charge_percentage: battery_harvest.charge_percent,
watt_consumption: format!("{:.2}W", battery_harvest.power_consumption_rate_watts),
duration_until_empty: if let Some(secs_till_empty) = battery_harvest.secs_until_empty {
- let time = chrono::Duration::seconds(secs_till_empty);
- let num_minutes = time.num_minutes() - time.num_hours() * 60;
- let num_seconds = time.num_seconds() - time.num_minutes() * 60;
+ let time = time::Duration::seconds(secs_till_empty);
+ let num_minutes = time.whole_minutes() - time.whole_hours() * 60;
+ let num_seconds = time.whole_seconds() - time.whole_minutes() * 60;
Some(format!(
"{} hour{}, {} minute{}, {} second{}",
- time.num_hours(),
- if time.num_hours() == 1 { "" } else { "s" },
+ time.whole_hours(),
+ if time.whole_hours() == 1 { "" } else { "s" },
num_minutes,
if num_minutes == 1 { "" } else { "s" },
num_seconds,
@@ -1391,13 +1391,13 @@ pub fn convert_battery_harvest(
None
},
duration_until_full: if let Some(secs_till_full) = battery_harvest.secs_until_full {
- let time = chrono::Duration::seconds(secs_till_full); // FIXME [DEP]: Can I get rid of chrono?
- let num_minutes = time.num_minutes() - time.num_hours() * 60;
- let num_seconds = time.num_seconds() - time.num_minutes() * 60;
+ let time = time::Duration::seconds(secs_till_full);
+ let num_minutes = time.whole_minutes() - time.whole_hours() * 60;
+ let num_seconds = time.whole_seconds() - time.whole_minutes() * 60;
Some(format!(
"{} hour{}, {} minute{}, {} second{}",
- time.num_hours(),
- if time.num_hours() == 1 { "" } else { "s" },
+ time.whole_hours(),
+ if time.whole_hours() == 1 { "" } else { "s" },
num_minutes,
if num_minutes == 1 { "" } else { "s" },
num_seconds,