Skip to content

Commit

Permalink
Round elapsed time to milliseconds if the part upload takes less than…
Browse files Browse the repository at this point in the history
… a second.
  • Loading branch information
stefansundin committed Nov 14, 2021
1 parent ad35525 commit a73bc70
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,13 @@ func run() (int, error) {

// Part upload has completed or failed
if uploadErr == nil {
fmt.Printf("\033[2K\rUploaded part %d in %s.\n", partNumber, time.Since(partStartTime).Round(time.Second))
timeElapsed := time.Since(partStartTime)
if timeElapsed < time.Second {
timeElapsed = timeElapsed.Round(time.Millisecond)
} else {
timeElapsed = timeElapsed.Round(time.Second)
}
fmt.Printf("\033[2K\rUploaded part %d in %s.\n", partNumber, timeElapsed)

// Check if the user wants to stop
if interrupted {
Expand Down

0 comments on commit a73bc70

Please sign in to comment.