From a46ac382071e95aef06f293f9e72be663bc95b64 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 14 Sep 2015 13:11:41 -0700 Subject: [PATCH] Show seconds and minutes only when hours and days are non zero --- time.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/time.go b/time.go index ed5925d2..5faf6fed 100644 --- a/time.go +++ b/time.go @@ -31,10 +31,10 @@ type humanizedTime struct { // String() humanizes humanizedTime to human readable, func (r humanizedTime) String() string { - if r.Minutes == 0 { + if r.Days == 0 && r.Hours == 0 && r.Minutes == 0 { return fmt.Sprintf("%d seconds", r.Seconds) } - if r.Hours == 0 { + if r.Days == 0 && r.Hours == 0 { return fmt.Sprintf("%d minutes %d seconds", r.Minutes, r.Seconds) } if r.Days == 0 {