Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
Replace flag.Int with flag.Duration to represent time
Browse files Browse the repository at this point in the history
This makes it less error prune, more readable and easier to use since
it does'nt require doing math convertions by hand in order to get time
in seconds.

Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
  • Loading branch information
wgrr committed Mar 30, 2020
1 parent 78e93bb commit 5299620
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

var (
timer = flag.Int64("timer", 3600, "This parameter define time in seconds to verify API ")
timer = flag.Duration("timer", time.Hour, "This parameter define time to verify API ")
)

// LastValues ...
Expand Down Expand Up @@ -102,7 +102,7 @@ func routine(duration time.Duration) {
lastValues = *currentValue
}
fmt.Println("opa time? ", duration, *timer)
time.Sleep(duration * time.Second)
time.Sleep(duration)
}
}

Expand Down

0 comments on commit 5299620

Please sign in to comment.