Show seconds and minutes only when hours and days are non zero

This commit is contained in:
Harshavardhana
2015-09-14 13:11:41 -07:00
parent 725847bd49
commit a46ac38207
+2 -2
View File
@@ -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 {