From 1cb26a2d554228dee18a246f7e0cb66e3b50da63 Mon Sep 17 00:00:00 2001 From: Andrey Sidorov Date: Mon, 23 Sep 2019 14:59:27 +0300 Subject: [PATCH] init --- go.mod | 3 +++ main.go | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 go.mod create mode 100644 main.go diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..a9bb4a7 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/qw1mb0/minutes + +go 1.12 diff --git a/main.go b/main.go new file mode 100644 index 0000000..7f851c2 --- /dev/null +++ b/main.go @@ -0,0 +1,24 @@ +package main + +import ( + "bufio" + "fmt" + "time" + "log" + "os" + "strings" +) + +func main() { + reader := bufio.NewReader(os.Stdin) + input, err := reader.ReadString('\n') + if err != nil { + log.Fatal("failed to read stdin: %s", err) + } + input = strings.TrimSuffix(input, "\n") + bro, err := time.ParseDuration(input) + if err != nil { + log.Fatal("failed to parse: %s", err) + } + fmt.Println(bro.Minutes()) +}