xmtop/utils/utils.go

18 lines
253 B
Go
Raw Normal View History

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