Redid how we auto-set time if we have autohide on.

This commit is contained in:
ClementTsang 2020-03-10 01:43:42 -04:00
parent 8630287676
commit 46f1b7df00
2 changed files with 11 additions and 3 deletions

View File

@ -246,7 +246,7 @@ impl Default for NetState {
zoom_level: 100.0,
display_time: constants::DEFAULT_TIME_MILLISECONDS,
force_update: false,
display_time_instant: Some(Instant::now()),
display_time_instant: None,
}
}
}
@ -269,7 +269,7 @@ impl Default for CpuState {
core_show_vec: Vec::new(),
display_time: constants::DEFAULT_TIME_MILLISECONDS,
force_update: false,
display_time_instant: Some(Instant::now()),
display_time_instant: None,
}
}
}
@ -294,7 +294,7 @@ impl Default for MemState {
zoom_level: 100.0,
display_time: constants::DEFAULT_TIME_MILLISECONDS,
force_update: false,
display_time_instant: Some(Instant::now()),
display_time_instant: None,
}
}
}

View File

@ -305,10 +305,18 @@ pub fn enable_hide_time(matches: &clap::ArgMatches<'static>, config: &Config, ap
pub fn enable_autohide_time(matches: &clap::ArgMatches<'static>, config: &Config, app: &mut App) {
if matches.is_present("AUTOHIDE_TIME") {
app.app_config_fields.autohide_time = true;
let time = Some(std::time::Instant::now());
app.cpu_state.display_time_instant = time;
app.mem_state.display_time_instant = time;
app.net_state.display_time_instant = time;
} else if let Some(flags) = &config.flags {
if let Some(autohide_time) = flags.autohide_time {
if autohide_time {
app.app_config_fields.autohide_time = true;
let time = Some(std::time::Instant::now());
app.cpu_state.display_time_instant = time;
app.mem_state.display_time_instant = time;
app.net_state.display_time_instant = time;
}
}
}