mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 19:13:34 +00:00
refactor(rtt): use proto Duration, add tests
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
package tui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"time"
|
||||
)
|
||||
|
||||
// FormatRTT formats a round-trip time duration as whole milliseconds, e.g. "140ms".
|
||||
func FormatRTT(d time.Duration) string {
|
||||
return fmt.Sprintf("%dms", int64(math.Round(float64(d)/float64(time.Millisecond))))
|
||||
}
|
||||
Reference in New Issue
Block a user