Simplify durationImpl
This commit is contained in:
parent
6b3b8e8c9b
commit
9a4a942cc4
1 changed files with 4 additions and 7 deletions
|
@ -156,14 +156,11 @@ func durationImpl(t time.Time, now time.Time) string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
diff := t.Sub(now)
|
if diff := t.Sub(now); diff >= 0 {
|
||||||
|
// Round to nearest second to get e.g. "14m56s" rather than "14m56.245483933s"
|
||||||
if diff < 0 {
|
return diff.Round(time.Second).String()
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
|
return ""
|
||||||
// Round to nearest second to get e.g. "14m56s" rather than "14m56.245483933s"
|
|
||||||
return diff.Round(time.Second).String()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func elapsedTime(printer *locale.Printer, tz string, t time.Time) string {
|
func elapsedTime(printer *locale.Printer, tz string, t time.Time) string {
|
||||||
|
|
Loading…
Reference in a new issue