Browse Source

Use IEC units for byte counting everywhere

Nicola Murino 4 years ago
parent
commit
1ac66d27b6
3 changed files with 6 additions and 6 deletions
  1. 1 1
      common/common.go
  2. 4 4
      dataprovider/user.go
  3. 1 1
      vfs/folder.go

+ 1 - 1
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

+ 4 - 4
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."
 	}

+ 1 - 1
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)