mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-22 07:30:25 +00:00
Use IEC units for byte counting everywhere
This commit is contained in:
parent
6a6e8fffbc
commit
1ac66d27b6
3 changed files with 6 additions and 6 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue