Core

/app/util/numeric.go (242 B)

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package util

import (
"fmt"
)

func MicrosToMillis(i int) string {
div := 1000

ms := i / div
if ms >= 20 {
return fmt.Sprintf("%dms", ms)
}

x := float64(ms) + (float64(i%div) / float64(div))
return fmt.Sprintf("%.3f", x) + "ms"
}