diff --git a/main.go b/main.go index 7fb4260..b856aa2 100644 --- a/main.go +++ b/main.go @@ -116,6 +116,7 @@ func stopwatchUI(startTime time.Time) { go func() { <-stop + fmt.Println() os.Exit(0) }() @@ -137,22 +138,22 @@ func timerUI(startTime time.Time) { go func() { <-stop - fmt.Printf("\n") + fmt.Println() os.Exit(0) }() for { elapsed := time.Until(startTime) - if elapsed.Milliseconds() == 0 { - fmt.Printf("\n") - break - } fmt.Printf("\r%02dd %02dh %02dm %02ds %03dms", elapsed/(24*time.Hour), (elapsed%(24*time.Hour))/time.Hour, (elapsed%time.Hour)/time.Minute, (elapsed%time.Minute)/time.Second, (elapsed%time.Second)/time.Millisecond) + if elapsed.Milliseconds() == 0 { + fmt.Println() + break + } time.Sleep(1 * time.Millisecond) } }