Simplify durationImpl

This commit is contained in:
jvoisin 2024-02-27 20:40:16 +01:00 committed by Frédéric Guillot
parent 6b3b8e8c9b
commit 9a4a942cc4

View file

@ -156,15 +156,12 @@ func durationImpl(t time.Time, now time.Time) string {
return ""
}
diff := t.Sub(now)
if diff < 0 {
return ""
}
if diff := t.Sub(now); diff >= 0 {
// Round to nearest second to get e.g. "14m56s" rather than "14m56.245483933s"
return diff.Round(time.Second).String()
}
return ""
}
func elapsedTime(printer *locale.Printer, tz string, t time.Time) string {
if t.IsZero() {