Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

cmd: always print elapsed time to tenth place seconds in progress

Gary Kime71edd557709
diff --git a/fs/accounting/stats.go b/fs/accounting/stats.go
index 0ed536b14..993afdcba 100644
--- a/fs/accounting/stats.go
+++ b/fs/accounting/stats.go
@@ -250,11 +250,11 @@ func (s *StatsInfo) String() string {
dt := s.totalDuration()
dtSeconds := dt.Seconds()
+ dtSecondsOnly := dt.Truncate(time.Second/10) % time.Minute
speed := 0.0
if dt > 0 {
speed = float64(s.bytes) / dtSeconds
}
- dtRounded := dt - (dt % (time.Second / 10))
displaySpeed := speed
if fs.Config.DataRateUnit == "bits" {
@@ -329,7 +329,7 @@ func (s *StatsInfo) String() string {
_, _ = fmt.Fprintf(buf, "Transferred: %10d / %d, %s\n",
s.transfers, totalTransfer, percent(s.transfers, totalTransfer))
}
- _, _ = fmt.Fprintf(buf, "Elapsed time: %10v\n", dtRounded)
+ _, _ = fmt.Fprintf(buf, "Elapsed time: %10ss\n", strings.TrimRight(dt.Truncate(time.Minute).String(), "0s")+fmt.Sprintf("%.1f", dtSecondsOnly.Seconds()))
}
// checking and transferring have their own locking so unlock