From a73bc70d589feafbcb3e2c97c1cdd2784532aef2 Mon Sep 17 00:00:00 2001 From: Stefan Sundin Date: Sat, 13 Nov 2021 17:17:03 -0800 Subject: [PATCH] Round elapsed time to milliseconds if the part upload takes less than a second. --- main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index fb31efe..d9db8bf 100644 --- a/main.go +++ b/main.go @@ -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 {