forked from mirror/go-ethereum
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
285 B
16 lines
285 B
10 years ago
|
package common
|
||
10 years ago
|
|
||
|
import "fmt"
|
||
|
|
||
|
type StorageSize float64
|
||
|
|
||
|
func (self StorageSize) String() string {
|
||
|
if self > 1000000 {
|
||
|
return fmt.Sprintf("%.2f mB", self/1000000)
|
||
|
} else if self > 1000 {
|
||
|
return fmt.Sprintf("%.2f kB", self/1000)
|
||
|
} else {
|
||
|
return fmt.Sprintf("%.2f B", self)
|
||
|
}
|
||
|
}
|