diff --git a/src/app/panels/middle/about.rs b/src/app/panels/middle/about.rs index d1fe7f8..134fff2 100644 --- a/src/app/panels/middle/about.rs +++ b/src/app/panels/middle/about.rs @@ -147,7 +147,7 @@ path_xmr: {:#?}\n )); } ui.label(format!( - "Gupaxx has been running for {}", + "Gupaxx has been running for\n{}", self.pub_sys.lock().unwrap().gupax_uptime )); }); diff --git a/src/app/panels/middle/status/processes.rs b/src/app/panels/middle/status/processes.rs index 8a8245b..1fbc830 100644 --- a/src/app/panels/middle/status/processes.rs +++ b/src/app/panels/middle/status/processes.rs @@ -1,5 +1,4 @@ use egui::{ScrollArea, Ui}; -use readable::up::UptimeFull; use std::sync::{Arc, Mutex}; use crate::app::eframe_impl::ProcessStatesGui; @@ -42,7 +41,6 @@ impl Status { ui.set_width(width_column); ui.set_height(height_column); ui.vertical_centered(|ui| { - // ui.set_min_width(ui.text_style_height(&TextStyle::Body) * 2.0); gupax(ui, sys); }); }); @@ -242,7 +240,7 @@ fn xmrig_proxy( let api = xmrig_proxy_api.lock().unwrap(); ui.label(RichText::new("Uptime").underline().color(BONE)) .on_hover_text(STATUS_XMRIG_PROXY_UPTIME); - ui.label(UptimeFull::from(api.uptime).as_str()); + ui.label(api.uptime.to_string()); ui.label( RichText::new("Hashrate\n(1m/10m/1h/12h/24h)") .underline() @@ -284,7 +282,7 @@ fn xmrig( let api = xmrig_api.lock().unwrap(); ui.label(RichText::new("Uptime").underline().color(BONE)) .on_hover_text(STATUS_XMRIG_UPTIME); - ui.label(UptimeFull::from(api.uptime).as_str()); + ui.label(api.uptime.to_string()); ui.label(api.resources.to_string()); ui.label( RichText::new("Hashrate\n(10s/1m/15m)") diff --git a/src/helper/xrig/xmrig.rs b/src/helper/xrig/xmrig.rs index 5ca3303..97f2a96 100644 --- a/src/helper/xrig/xmrig.rs +++ b/src/helper/xrig/xmrig.rs @@ -3,6 +3,7 @@ use crate::helper::xrig::update_xmrig_config; use crate::helper::{Helper, ProcessName, ProcessSignal, ProcessState}; use crate::helper::{Process, arc_mut, check_died, check_user_input, sleep, sleep_end_loop}; use crate::helper::{PubXvbApi, XvbNode}; +use crate::human::HumanTime; use crate::miscs::{client, output_console}; use crate::regex::{XMRIG_REGEX, contains_error, contains_usepool, detect_new_node_xmrig}; use crate::utils::human::HumanNumber; @@ -688,7 +689,7 @@ impl ImgXmrig { #[derive(Debug, Clone)] pub struct PubXmrigApi { pub output: String, - pub uptime: Duration, + pub uptime: HumanTime, pub worker_id: String, pub resources: String, pub hashrate: String, @@ -711,7 +712,7 @@ impl PubXmrigApi { pub fn new() -> Self { Self { output: String::new(), - uptime: Duration::from_secs(0), + uptime: HumanTime::new(), worker_id: UNKNOWN_DATA.to_string(), resources: UNKNOWN_DATA.to_string(), hashrate: UNKNOWN_DATA.to_string(), @@ -755,7 +756,7 @@ impl PubXmrigApi { public.output.push_str(&std::mem::take(&mut *output_pub)); } // Update uptime - public.uptime = elapsed; + public.uptime = HumanTime::into_human(elapsed); } drop(output_pub); diff --git a/src/helper/xrig/xmrig_proxy.rs b/src/helper/xrig/xmrig_proxy.rs index 4c1853b..711e3e1 100644 --- a/src/helper/xrig/xmrig_proxy.rs +++ b/src/helper/xrig/xmrig_proxy.rs @@ -8,10 +8,11 @@ use std::{ path::Path, sync::{Arc, Mutex}, thread, - time::{Duration, Instant}, + time::Instant, }; use tokio::spawn; +use crate::human::HumanTime; use crate::miscs::client; use crate::{ GUPAX_VERSION_UNDERSCORE, UNKNOWN_DATA, @@ -469,7 +470,7 @@ impl Helper { #[derive(Debug, Clone)] pub struct PubXmrigProxyApi { pub output: String, - pub uptime: Duration, + pub uptime: HumanTime, pub accepted: u32, pub rejected: u32, pub hashrate_1m: f32, @@ -489,7 +490,7 @@ impl PubXmrigProxyApi { pub fn new() -> Self { Self { output: String::new(), - uptime: Duration::from_secs(0), + uptime: HumanTime::new(), accepted: 0, rejected: 0, hashrate_1m: 0.0, @@ -515,7 +516,7 @@ impl PubXmrigProxyApi { public.output.push_str(&std::mem::take(&mut *output_pub)); } // Update uptime - public.uptime = elapsed; + public.uptime = HumanTime::into_human(elapsed); } drop(output_pub);