Commit 35c900aa authored by Xing Zhou's avatar Xing Zhou

Fixed a tiny issue for ShortHumanDuration printer.

Fixed a tiny issue for ShortHumanDuration printer to avoid "0y" message.
parent c20e63bf
...@@ -34,7 +34,7 @@ func ShortHumanDuration(d time.Duration) string { ...@@ -34,7 +34,7 @@ func ShortHumanDuration(d time.Duration) string {
return fmt.Sprintf("%dm", minutes) return fmt.Sprintf("%dm", minutes)
} else if hours := int(d.Hours()); hours < 24 { } else if hours := int(d.Hours()); hours < 24 {
return fmt.Sprintf("%dh", hours) return fmt.Sprintf("%dh", hours)
} else if hours < 24*364 { } else if hours < 24*365 {
return fmt.Sprintf("%dd", hours/24) return fmt.Sprintf("%dd", hours/24)
} }
return fmt.Sprintf("%dy", int(d.Hours()/24/365)) return fmt.Sprintf("%dy", int(d.Hours()/24/365))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment