aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetter Rasmussen2015-03-21 12:04:38 +0100
committerPetter Rasmussen2015-03-21 12:04:38 +0100
commit11b4eae44a48deb769258867b359dbcd74da6d59 (patch)
treebcf33ee7fea7cc46732150455aefe2abb8b9ed5a
parentdbda1f9110933f542430bcbfe269bd4eb6c9f6e2 (diff)
downloadgdrive-11b4eae44a48deb769258867b359dbcd74da6d59.tar.bz2
Show 1 decimal place
-rw-r--r--util/generic.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/generic.go b/util/generic.go
index e844d00..2b26d60 100644
--- a/util/generic.go
+++ b/util/generic.go
@@ -52,13 +52,13 @@ func FileSizeFormat(bytes int64) string {
units := []string{"B", "KB", "MB", "GB", "TB", "PB"}
var i int
- value := bytes
+ value := float64(bytes)
for value > 1000 {
value /= 1000
i++
}
- return fmt.Sprintf("%d %s", value, units[i])
+ return fmt.Sprintf("%.1f %s", value, units[i])
}
// Truncates string to given max length, and inserts ellipsis into