Working remote print integration
This commit is contained in:
@@ -5,3 +5,4 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
nalgebra.workspace = true
|
||||
rand.workspace = true
|
||||
|
@@ -1,5 +1,7 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use rand::{distributions::Alphanumeric, Rng};
|
||||
|
||||
use crate::config::SliceConfig;
|
||||
|
||||
pub struct SliceResult<'a, Layer> {
|
||||
@@ -26,9 +28,27 @@ pub fn human_duration(duration: Duration) -> String {
|
||||
format!("{:}ms", ms)
|
||||
} else if ms < 60_000.0 {
|
||||
format!("{:.2}s", ms / 1000.0)
|
||||
} else {
|
||||
} else if ms < 3_600_000.0 {
|
||||
let minutes = ms / 60_000.0;
|
||||
let seconds = (minutes - minutes.floor()) * 60.0;
|
||||
format!("{:.0}m {:.2}s", minutes.floor(), seconds)
|
||||
} else {
|
||||
let hours = ms / 3_600_000.0;
|
||||
let minutes = (hours - hours.floor()) * 60.0;
|
||||
let seconds = (minutes - minutes.floor()) * 60.0;
|
||||
format!(
|
||||
"{:.0}h {:.0}m {:.2}s",
|
||||
hours.floor(),
|
||||
minutes.floor(),
|
||||
seconds
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn random_string(len: usize) -> String {
|
||||
rand::thread_rng()
|
||||
.sample_iter(&Alphanumeric)
|
||||
.take(len)
|
||||
.map(char::from)
|
||||
.collect()
|
||||
}
|
||||
|
Reference in New Issue
Block a user