mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-11-25 04:40:02 +01:00
Lint
This commit is contained in:
parent
01b397a31a
commit
94f60fb5b8
1 changed files with 2 additions and 0 deletions
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue