mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-04 12:52:28 +08:00
feat: add Reset func for watcher
This commit is contained in:
@@ -20,6 +20,7 @@ func (w *Watcher) Stop() {
|
||||
w.stopTime = time.Now().UnixNano()
|
||||
w.excuting = false
|
||||
}
|
||||
|
||||
// GetElapsedTime get excute elapsed time.
|
||||
func (w *Watcher) GetElapsedTime() time.Duration {
|
||||
if w.excuting {
|
||||
@@ -28,3 +29,10 @@ func (w *Watcher) GetElapsedTime() time.Duration {
|
||||
return time.Duration(w.stopTime - w.startTime)
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the watch timer.
|
||||
func (w *Watcher) Reset() {
|
||||
w.startTime = 0
|
||||
w.stopTime = 0
|
||||
w.excuting = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user