summaryrefslogtreecommitdiff
path: root/common/pretty/duration.go
blob: 6b4eda4616013f073e031da2adc73dfc3cd17cf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package pretty

import (
	"fmt"
	"time"
)

func Duration(duration time.Duration) string {
	d := int64(duration.Seconds())
	h := d / 3600
	m := (d % 3600) / 60
	s := d % 60
	return fmt.Sprintf("%02d:%02d:%02d", h, m, s)
}