From dc6c6db47f2000fc34301a87ae7b2f4ce92b231c Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Mon, 18 Jun 2018 11:41:04 -0600 Subject: [PATCH] trying to prevent 2h jump on difference too great --- main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index b899a9f..36aad4a 100644 --- a/main.go +++ b/main.go @@ -78,16 +78,15 @@ func main() { select { case <-monitor.C: difference := time.Duration(time.Now().UnixNano() - last.UnixNano()) + last = time.Now() if difference > time.Hour*2 { keych <- 'p' continue - } - if invert { + } else if invert { cur += difference } else { cur -= difference } - last = time.Now() case state := <-pause: if !state { monitor = time.NewTicker(tickerInterval)