docker images friendly duration gets unfriendly after a while

fix #12852
Signed-off-by: Daniel Zhang <jmzwcn@gmail.com>
This commit is contained in:
Daniel Zhang 2015-04-30 13:38:54 +08:00
parent 861cba008d
commit 7a9788fb68
2 changed files with 4 additions and 3 deletions

View file

@ -26,6 +26,7 @@ func HumanDuration(d time.Duration) string {
return fmt.Sprintf("%d weeks", hours/24/7)
} else if hours < 24*365*2 {
return fmt.Sprintf("%d months", hours/24/30)
} else {
return fmt.Sprintf("%d years", hours/24/365)
}
return fmt.Sprintf("%f years", d.Hours()/24/365)
}