From 1ac66d27b6a9b6ce10506e6ad2a8617d3229ebad Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Fri, 12 Feb 2021 22:16:35 +0100 Subject: [PATCH] Use IEC units for byte counting everywhere --- common/common.go | 2 +- dataprovider/user.go | 8 ++++---- vfs/folder.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/common.go b/common/common.go index f661ca25..656bfc14 100644 --- a/common/common.go +++ b/common/common.go @@ -267,7 +267,7 @@ func (t *ConnectionTransfer) getConnectionTransferAsString() string { if t.Size > 0 { elapsed := time.Since(utils.GetTimeFromMsecSinceEpoch(t.StartTime)) speed := float64(t.Size) / float64(utils.GetTimeAsMsSinceEpoch(time.Now())-t.StartTime) - result += fmt.Sprintf("Size: %#v Elapsed: %#v Speed: \"%.1f KB/s\"", utils.ByteCountSI(t.Size), + result += fmt.Sprintf("Size: %#v Elapsed: %#v Speed: \"%.1f KB/s\"", utils.ByteCountIEC(t.Size), utils.GetDurationAsString(elapsed), speed) } return result diff --git a/dataprovider/user.go b/dataprovider/user.go index 1b3f61fd..5e97807d 100644 --- a/dataprovider/user.go +++ b/dataprovider/user.go @@ -706,9 +706,9 @@ func (u *User) GetQuotaSummary() string { result += "/" + strconv.Itoa(u.QuotaFiles) } if u.UsedQuotaSize > 0 || u.QuotaSize > 0 { - result += ". Size: " + utils.ByteCountSI(u.UsedQuotaSize) + result += ". Size: " + utils.ByteCountIEC(u.UsedQuotaSize) if u.QuotaSize > 0 { - result += "/" + utils.ByteCountSI(u.QuotaSize) + result += "/" + utils.ByteCountIEC(u.QuotaSize) } } return result @@ -740,13 +740,13 @@ func (u *User) GetPermissionsAsString() string { func (u *User) GetBandwidthAsString() string { result := "Download: " if u.DownloadBandwidth > 0 { - result += utils.ByteCountSI(u.DownloadBandwidth*1000) + "/s." + result += utils.ByteCountIEC(u.DownloadBandwidth*1000) + "/s." } else { result += "unlimited." } result += " Upload: " if u.UploadBandwidth > 0 { - result += utils.ByteCountSI(u.UploadBandwidth*1000) + "/s." + result += utils.ByteCountIEC(u.UploadBandwidth*1000) + "/s." } else { result += "unlimited." } diff --git a/vfs/folder.go b/vfs/folder.go index 125bf771..1d1e82f3 100644 --- a/vfs/folder.go +++ b/vfs/folder.go @@ -49,7 +49,7 @@ func (v *BaseVirtualFolder) GetQuotaSummary() string { var result string result = "Files: " + strconv.Itoa(v.UsedQuotaFiles) if v.UsedQuotaSize > 0 { - result += ". Size: " + utils.ByteCountSI(v.UsedQuotaSize) + result += ". Size: " + utils.ByteCountIEC(v.UsedQuotaSize) } if v.LastQuotaUpdate > 0 { t := utils.GetTimeFromMsecSinceEpoch(v.LastQuotaUpdate)