Merge pull request #44600 from xingzhou/kube-44599

Automatic merge from submit-queue

Fixed a tiny issue for ShortHumanDuration printer.

Fixed a tiny issue for ShortHumanDuration printer
to avoid "0y" message.

Fixed #44599
This commit is contained in:
Kubernetes Submit Queue 2017-04-25 08:59:07 -07:00 committed by GitHub
commit 22957509e7

View File

@ -34,7 +34,7 @@ func ShortHumanDuration(d time.Duration) string {
return fmt.Sprintf("%dm", minutes)
} else if hours := int(d.Hours()); hours < 24 {
return fmt.Sprintf("%dh", hours)
} else if hours < 24*364 {
} else if hours < 24*365 {
return fmt.Sprintf("%dd", hours/24)
}
return fmt.Sprintf("%dy", int(d.Hours()/24/365))