lower tick rate when non-millis

This commit is contained in:
race604 2022-08-03 19:11:36 +08:00
parent 228faf45c6
commit d8dd061d97
2 changed files with 5 additions and 5 deletions

View file

@ -31,7 +31,7 @@ pub(crate) enum Mode {
duration: Duration, duration: Duration,
/// Hide milliseconds /// Hide milliseconds
#[clap(long = "no-millis", takes_value = false)] #[clap(long = "no-millis", short = 'M', takes_value = false)]
no_millis: bool, no_millis: bool,
}, },
/// The stopwatch mode displays the elapsed time since it was started. /// The stopwatch mode displays the elapsed time since it was started.

View file

@ -60,10 +60,10 @@ fn main() -> Result<(), Box<dyn Error>> {
let mut terminal = Terminal::new(backend)?; let mut terminal = Terminal::new(backend)?;
// create app and run it // create app and run it
let low_rate = if let Some(Mode::Clock { millis, .. }) = app.mode { let low_rate = match app.mode {
!millis Some(Mode::Clock { millis, .. }) => !millis,
} else { Some(Mode::Timer { no_millis, .. }) => no_millis,
false _ => false,
}; };
let tick_rate = Duration::from_millis(if low_rate { 200 } else { 20 }); let tick_rate = Duration::from_millis(if low_rate { 200 } else { 20 });
let res = run_app(&mut terminal, &mut app, tick_rate); let res = run_app(&mut terminal, &mut app, tick_rate);