Skip to content

Commit

Permalink
only once
Browse files Browse the repository at this point in the history
  • Loading branch information
drgrib committed Apr 27, 2018
1 parent 7460827 commit 819ffa3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,13 @@ func (t *Timer) Start(d time.Duration) {
if t.Title == "" {
t.Title = Sprintf("%v Timer", d)
}
t.end = time.Now().Add(t.duration)
// strip monotonic time to account for system changes
t.end = time.Now().Add(t.duration).Round(0)
}

func (t *Timer) update() {
t.status = "Finished"
now := time.Now()
// strip monotonic time to account for system changes
t.end = t.end.Round(0)
if !now.After(t.end) {
exactLeft := t.end.Sub(now)
floorSeconds := math.Floor(exactLeft.Seconds())
Expand Down

0 comments on commit 819ffa3

Please sign in to comment.