diff options
author | Blaž Hrastnik | 2022-02-13 09:31:51 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-02-13 09:31:51 +0000 |
commit | bd549d8a20cce98e24c8653a4a86107c786cbaa3 (patch) | |
tree | 0780b58d41b6181e69023265cdb54517e2953778 /helix-term/src/ui/spinner.rs | |
parent | 7ad8eaaef0b292f4be6c66298cea40d2b928e172 (diff) | |
parent | 7083b98a388b30e0b61caac9bf6ccc1d79eadf81 (diff) |
Merge remote-tracking branch 'origin/master' into debug
Diffstat (limited to 'helix-term/src/ui/spinner.rs')
-rw-r--r-- | helix-term/src/ui/spinner.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/helix-term/src/ui/spinner.rs b/helix-term/src/ui/spinner.rs index e8a43b48..68965469 100644 --- a/helix-term/src/ui/spinner.rs +++ b/helix-term/src/ui/spinner.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, time::SystemTime}; +use std::{collections::HashMap, time::Instant}; #[derive(Default, Debug)] pub struct ProgressSpinners { @@ -25,7 +25,7 @@ impl Default for Spinner { pub struct Spinner { frames: Vec<&'static str>, count: usize, - start: Option<SystemTime>, + start: Option<Instant>, interval: u64, } @@ -50,14 +50,13 @@ impl Spinner { } pub fn start(&mut self) { - self.start = Some(SystemTime::now()); + self.start = Some(Instant::now()); } pub fn frame(&self) -> Option<&str> { let idx = (self .start - .map(|time| SystemTime::now().duration_since(time))? - .ok()? + .map(|time| Instant::now().duration_since(time))? .as_millis() / self.interval as u128) as usize % self.count; |