summaryrefslogtreecommitdiff
path: root/vendor/github.com/docker/go-units/duration.go
diff options
context:
space:
mode:
authorumohnani8 <umohnani@redhat.com>2017-11-28 09:26:13 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2017-11-28 16:09:13 +0000
commitc0eceaa403a739355c6e2715b3354f7b15f35fb8 (patch)
tree4de7905a5fd14ac7146a74e46d49a3fbc3f5902a /vendor/github.com/docker/go-units/duration.go
parentab62fe17ff7910a4727e07f6d075b425185a5860 (diff)
downloadpodman-c0eceaa403a739355c6e2715b3354f7b15f35fb8.tar.gz
podman-c0eceaa403a739355c6e2715b3354f7b15f35fb8.tar.bz2
podman-c0eceaa403a739355c6e2715b3354f7b15f35fb8.zip
Vendor in v0.3.2 of docker/go-units
docker/go-units is used in converting bytes to human readable format Signed-off-by: umohnani8 <umohnani@redhat.com> Closes: #82 Approved by: rhatdan
Diffstat (limited to 'vendor/github.com/docker/go-units/duration.go')
-rw-r--r--vendor/github.com/docker/go-units/duration.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/vendor/github.com/docker/go-units/duration.go b/vendor/github.com/docker/go-units/duration.go
index c219a8a96..ba02af26d 100644
--- a/vendor/github.com/docker/go-units/duration.go
+++ b/vendor/github.com/docker/go-units/duration.go
@@ -12,19 +12,21 @@ import (
func HumanDuration(d time.Duration) string {
if seconds := int(d.Seconds()); seconds < 1 {
return "Less than a second"
+ } else if seconds == 1 {
+ return "1 second"
} else if seconds < 60 {
return fmt.Sprintf("%d seconds", seconds)
} else if minutes := int(d.Minutes()); minutes == 1 {
return "About a minute"
- } else if minutes < 60 {
+ } else if minutes < 46 {
return fmt.Sprintf("%d minutes", minutes)
- } else if hours := int(d.Hours()); hours == 1 {
+ } else if hours := int(d.Hours() + 0.5); hours == 1 {
return "About an hour"
} else if hours < 48 {
return fmt.Sprintf("%d hours", hours)
} else if hours < 24*7*2 {
return fmt.Sprintf("%d days", hours/24)
- } else if hours < 24*30*3 {
+ } else if hours < 24*30*2 {
return fmt.Sprintf("%d weeks", hours/24/7)
} else if hours < 24*365*2 {
return fmt.Sprintf("%d months", hours/24/30)