fix: use human time on multiple lines for everything.

This commit is contained in:
Cyrix126 2024-12-12 00:31:42 +01:00
parent 6ff16af175
commit f5b765c55f
4 changed files with 12 additions and 12 deletions

View file

@ -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
));
});

View file

@ -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)")

View file

@ -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);

View file

@ -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);