mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 07:10:56 +03:00
Use IEC units for byte counting everywhere
This commit is contained in:
@@ -267,7 +267,7 @@ func (t *ConnectionTransfer) getConnectionTransferAsString() string {
|
|||||||
if t.Size > 0 {
|
if t.Size > 0 {
|
||||||
elapsed := time.Since(utils.GetTimeFromMsecSinceEpoch(t.StartTime))
|
elapsed := time.Since(utils.GetTimeFromMsecSinceEpoch(t.StartTime))
|
||||||
speed := float64(t.Size) / float64(utils.GetTimeAsMsSinceEpoch(time.Now())-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)
|
utils.GetDurationAsString(elapsed), speed)
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -706,9 +706,9 @@ func (u *User) GetQuotaSummary() string {
|
|||||||
result += "/" + strconv.Itoa(u.QuotaFiles)
|
result += "/" + strconv.Itoa(u.QuotaFiles)
|
||||||
}
|
}
|
||||||
if u.UsedQuotaSize > 0 || u.QuotaSize > 0 {
|
if u.UsedQuotaSize > 0 || u.QuotaSize > 0 {
|
||||||
result += ". Size: " + utils.ByteCountSI(u.UsedQuotaSize)
|
result += ". Size: " + utils.ByteCountIEC(u.UsedQuotaSize)
|
||||||
if u.QuotaSize > 0 {
|
if u.QuotaSize > 0 {
|
||||||
result += "/" + utils.ByteCountSI(u.QuotaSize)
|
result += "/" + utils.ByteCountIEC(u.QuotaSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
@@ -740,13 +740,13 @@ func (u *User) GetPermissionsAsString() string {
|
|||||||
func (u *User) GetBandwidthAsString() string {
|
func (u *User) GetBandwidthAsString() string {
|
||||||
result := "Download: "
|
result := "Download: "
|
||||||
if u.DownloadBandwidth > 0 {
|
if u.DownloadBandwidth > 0 {
|
||||||
result += utils.ByteCountSI(u.DownloadBandwidth*1000) + "/s."
|
result += utils.ByteCountIEC(u.DownloadBandwidth*1000) + "/s."
|
||||||
} else {
|
} else {
|
||||||
result += "unlimited."
|
result += "unlimited."
|
||||||
}
|
}
|
||||||
result += " Upload: "
|
result += " Upload: "
|
||||||
if u.UploadBandwidth > 0 {
|
if u.UploadBandwidth > 0 {
|
||||||
result += utils.ByteCountSI(u.UploadBandwidth*1000) + "/s."
|
result += utils.ByteCountIEC(u.UploadBandwidth*1000) + "/s."
|
||||||
} else {
|
} else {
|
||||||
result += "unlimited."
|
result += "unlimited."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ func (v *BaseVirtualFolder) GetQuotaSummary() string {
|
|||||||
var result string
|
var result string
|
||||||
result = "Files: " + strconv.Itoa(v.UsedQuotaFiles)
|
result = "Files: " + strconv.Itoa(v.UsedQuotaFiles)
|
||||||
if v.UsedQuotaSize > 0 {
|
if v.UsedQuotaSize > 0 {
|
||||||
result += ". Size: " + utils.ByteCountSI(v.UsedQuotaSize)
|
result += ". Size: " + utils.ByteCountIEC(v.UsedQuotaSize)
|
||||||
}
|
}
|
||||||
if v.LastQuotaUpdate > 0 {
|
if v.LastQuotaUpdate > 0 {
|
||||||
t := utils.GetTimeFromMsecSinceEpoch(v.LastQuotaUpdate)
|
t := utils.GetTimeFromMsecSinceEpoch(v.LastQuotaUpdate)
|
||||||
|
|||||||
Reference in New Issue
Block a user