From 69dcd8418a19db3f403a66ce1767e5f24a5cfc6c Mon Sep 17 00:00:00 2001 From: tijl Date: Fri, 27 Sep 2024 18:05:35 +0200 Subject: [PATCH] updates --- main.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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) } }