mirror of
https://github.com/kopia/kopia.git
synced 2026-05-09 15:23:02 -04:00
Change Mbit/s units to MB/s (base-10) (#1522)
This commit is contained in:
@@ -246,7 +246,7 @@ func (c *commandRepositorySyncTo) runSyncBlobs(ctx context.Context, src blob.Rea
|
||||
|
||||
if est, ok := tt.Estimate(float64(bytesCopied), float64(totalBytes)); ok {
|
||||
eta = fmt.Sprintf("%v (%v)", est.Remaining, formatTimestamp(est.EstimatedEndTime))
|
||||
speed = units.BitsPerSecondsString(est.SpeedPerSecond * 8) //nolint:gomnd
|
||||
speed = units.BytesPerSecondsString(est.SpeedPerSecond)
|
||||
}
|
||||
|
||||
c.outputSyncProgress(
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
const (
|
||||
restoreCommandHelp = `Restore a directory or a file.
|
||||
|
||||
Restore can operate in two modes:
|
||||
Restore can operate in two modes:
|
||||
|
||||
* from a snapshot: restoring (possibly shallowly) a specified file or
|
||||
directory from a snapshot into a target path. By default, the target
|
||||
@@ -33,7 +33,7 @@
|
||||
* by expanding a shallow placeholder in situ where the placeholder was
|
||||
created by a previous restore.
|
||||
|
||||
In the from-snapshot mode:
|
||||
In the from-snapshot mode:
|
||||
|
||||
The source to be restored is specified in the form of a directory or file ID and
|
||||
optionally a sub-directory path.
|
||||
@@ -87,7 +87,6 @@
|
||||
2. one or more placeholder files of the form path.kopia-entry
|
||||
`
|
||||
|
||||
bitsPerByte = 8
|
||||
unlimitedDepth = math.MaxInt32
|
||||
)
|
||||
|
||||
@@ -362,9 +361,8 @@ func (c *commandRestore) run(ctx context.Context, rep repo.Repository) error {
|
||||
var maybeRemaining, maybeSkipped, maybeErrors string
|
||||
|
||||
if est, ok := eta.Estimate(float64(stats.RestoredTotalFileSize), float64(stats.EnqueuedTotalFileSize)); ok {
|
||||
bitsPerSecond := est.SpeedPerSecond * float64(bitsPerByte)
|
||||
maybeRemaining = fmt.Sprintf(" %v (%.1f%%) remaining %v",
|
||||
units.BitsPerSecondsString(bitsPerSecond),
|
||||
units.BytesPerSecondsString(est.SpeedPerSecond),
|
||||
est.PercentComplete,
|
||||
est.Remaining)
|
||||
}
|
||||
|
||||
@@ -39,10 +39,10 @@ func BytesStringBase2(b int64) string {
|
||||
return toDecimalUnitString(float64(b), 1024.0, base2UnitPrefixes, "B")
|
||||
}
|
||||
|
||||
// BitsPerSecondsString formats the given value bits per second with the appropriate suffix (Kbit/s, Mbit/s, Gbit/s, ...)
|
||||
func BitsPerSecondsString(bps float64) string {
|
||||
// BytesPerSecondsString formats the given value bytes per second with the appropriate base-10 suffix (KB/s, MB/s, GB/s, ...)
|
||||
func BytesPerSecondsString(bps float64) string {
|
||||
// nolint:gomnd
|
||||
return toDecimalUnitString(bps, 1000, base10UnitPrefixes, "bit/s")
|
||||
return toDecimalUnitString(bps, 1000, base10UnitPrefixes, "B/s")
|
||||
}
|
||||
|
||||
// Count returns the given number with the appropriate base-10 suffix (K, M, G, ...)
|
||||
|
||||
Reference in New Issue
Block a user