generated from PlexSheep/rs-base
Merge pull request #4 from race604/lower-rate-when-non-millis
lower tick rate when non-millis
This commit is contained in:
commit
684384c3ee
2 changed files with 5 additions and 5 deletions
|
@ -31,7 +31,7 @@ pub(crate) enum Mode {
|
|||
duration: Duration,
|
||||
|
||||
/// Hide milliseconds
|
||||
#[clap(long = "no-millis", takes_value = false)]
|
||||
#[clap(long = "no-millis", short = 'M', takes_value = false)]
|
||||
no_millis: bool,
|
||||
},
|
||||
/// The stopwatch mode displays the elapsed time since it was started.
|
||||
|
|
|
@ -60,10 +60,10 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||
let mut terminal = Terminal::new(backend)?;
|
||||
|
||||
// create app and run it
|
||||
let low_rate = if let Some(Mode::Clock { millis, .. }) = app.mode {
|
||||
!millis
|
||||
} else {
|
||||
false
|
||||
let low_rate = match app.mode {
|
||||
Some(Mode::Clock { millis, .. }) => !millis,
|
||||
Some(Mode::Timer { no_millis, .. }) => no_millis,
|
||||
_ => false,
|
||||
};
|
||||
let tick_rate = Duration::from_millis(if low_rate { 200 } else { 20 });
|
||||
let res = run_app(&mut terminal, &mut app, tick_rate);
|
||||
|
|
Reference in a new issue