1
0
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:
dudaodong
2022-01-01 20:14:41 +08:00
parent 7db46696f6
commit 94b1a1d383

View File

@@ -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
}