xmtop/utils/utils.go

18 lines
280 B
Go
Raw Normal View History

2018-02-19 15:25:02 +08:00
package utils
import (
"math"
)
func BytesToKB(b uint64) uint64 {
return uint64((float64(b) / math.Pow10(3)))
2018-02-19 15:25:02 +08:00
}
func BytesToMB(b uint64) uint64 {
return uint64((float64(b) / math.Pow10(6)))
2018-02-19 15:25:02 +08:00
}
func BytesToGB(b uint64) uint64 {
return uint64((float64(b) / math.Pow10(9)))
2018-02-19 15:25:02 +08:00
}