Browse Source

Fix inaccurate timer

Issue #6

totalSeconds is always 1 second too long since we include counting down to 0.
This commit starts the timer decremented 1 second to fix the issue.
master
Blaine Motsinger 8 months ago
parent
commit
8bcbf691a0
1 changed files with 2 additions and 0 deletions
  1. 2
    0
      src/main.go

+ 2
- 0
src/main.go View File

@@ -87,6 +87,8 @@ func main() {
os.Exit(0)
}

totalSeconds-- // decrement 1 second to start for accuracy

// TODO: switch to time.ParseDuration
for totalSeconds > 0 {
fmt.Printf("seconds remaining: %v ", totalSeconds)

Loading…
Cancel
Save