cmd/lncli: remove usage of Millisecond() for Go 1.12

The new table format for the pay command started to use the
`Millisecond()` method on `time.Duration`. However, this method was only
added in Go 1.13, so this breaks the build for Go 1.12. We replace this
by manual division. `time.Duration` "natively" is in nanoseconds, so we
covert to milli seconds by dividing my `time.Millisecond`, which is
1,000,000.
This commit is contained in:
Olaoluwa Osuntokun 2020-05-06 16:22:47 -07:00
parent 0dfb946afd
commit 352d45a11e
No known key found for this signature in database
GPG Key ID: BC13F65E2DC84465

@ -605,8 +605,8 @@ func formatPayment(payment *lnrpc.Payment, aliases *aliasCache) string {
return "-" return "-"
} }
resolveTime := time.Unix(0, timeNs) resolveTime := time.Unix(0, timeNs)
resolveTimeMs := resolveTime.Sub(createTime). resolveTimeDiff := resolveTime.Sub(createTime)
Milliseconds() resolveTimeMs := resolveTimeDiff / time.Millisecond
return fmt.Sprintf( return fmt.Sprintf(
"%.3f", float64(resolveTimeMs)/1000.0, "%.3f", float64(resolveTimeMs)/1000.0,
) )