From 4a434767a4aa96c26778c230deddd8909ad031f5 Mon Sep 17 00:00:00 2001 From: andig Date: Sun, 31 Jan 2021 21:46:46 +0100 Subject: [PATCH] Always round durations to seconds --- util/format.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/util/format.go b/util/format.go index 5f1db3422..71811b5ac 100644 --- a/util/format.go +++ b/util/format.go @@ -4,6 +4,7 @@ import ( "fmt" "regexp" "strings" + "time" ) var re = regexp.MustCompile(`\${(\w+)(:([a-zA-Z0-9%.]+))?}`) @@ -32,6 +33,8 @@ func FormatValue(format string, val interface{}) string { format = format[:len(format)-1] val = typed / 1e3 } + case time.Duration: + val = typed.Round(time.Second) } if format == "" {