From 94f60fb5b8b6be2cdcb48292b5a05c0b3bb6805e Mon Sep 17 00:00:00 2001 From: binwiederhier Date: Thu, 7 Mar 2024 12:53:39 -0500 Subject: [PATCH] Lint --- util/time.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/time.go b/util/time.go index d4405236..9fbee890 100644 --- a/util/time.go +++ b/util/time.go @@ -83,6 +83,8 @@ func ParseDuration(s string) (time.Duration, error) { return 0, errInvalidDuration } +// FormatDuration formats a time.Duration into a human-readable string, e.g. "2d", "20h", "30m", "40s". +// It rounds to the largest unit that is not zero, thereby effectively rounding down. func FormatDuration(d time.Duration) string { if d >= 24*time.Hour { return strconv.Itoa(int(d/(24*time.Hour))) + "d"