From b5234413611ce5984292f85a01de1f56c045b490 Mon Sep 17 00:00:00 2001 From: obscuren Date: Mon, 16 Mar 2015 11:27:38 +0100 Subject: Moved ethutil => common --- common/size.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 common/size.go (limited to 'common/size.go') diff --git a/common/size.go b/common/size.go new file mode 100644 index 000000000..80a17279b --- /dev/null +++ b/common/size.go @@ -0,0 +1,15 @@ +package common + +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) + } +} -- cgit