Implemented cmd runtime expansion for the prompt
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
use std::time::{Duration, Instant};
|
||||
use crate::prelude::*;
|
||||
|
||||
#[derive(Clone,Debug)]
|
||||
pub struct MetaTab {
|
||||
timer_start: Option<Instant>,
|
||||
timer_start: Instant,
|
||||
last_runtime: Option<Duration>,
|
||||
last_status: i32
|
||||
}
|
||||
@@ -10,19 +11,16 @@ pub struct MetaTab {
|
||||
impl MetaTab {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
timer_start: None,
|
||||
timer_start: Instant::now(),
|
||||
last_runtime: None,
|
||||
last_status: 0
|
||||
}
|
||||
}
|
||||
pub fn start_timer(&mut self) {
|
||||
self.timer_start = Some(Instant::now())
|
||||
self.timer_start = Instant::now();
|
||||
}
|
||||
pub fn stop_timer(&mut self) {
|
||||
let timer_start = self.timer_start.take();
|
||||
if let Some(instant) = timer_start {
|
||||
self.last_runtime = Some(instant.elapsed())
|
||||
}
|
||||
self.last_runtime = Some(self.timer_start.elapsed());
|
||||
}
|
||||
pub fn get_runtime(&self) -> Option<Duration> {
|
||||
self.last_runtime
|
||||
|
||||
Reference in New Issue
Block a user