Implemented simple sleep

This commit is contained in:
Eric Neidhardt 2020-01-21 07:33:45 +01:00
parent 5bce145ee6
commit f195167756

View File

@ -1,5 +1,21 @@
package main
import "os"
import "strconv"
import "fmt"
import "time"
func main() {
// TODO
sleep := 1
if len(os.Args) > 1 {
var err error
sleep, err = strconv.Atoi(os.Args[1])
if err != nil {
fmt.Printf("Given %s is not a valid sleep time\n", os.Args[1])
os.Exit(1)
}
}
time.Sleep(time.Duration(sleep) * time.Second)
}