From fc550e3de2881808016944bd0dc34059e6ecbb23 Mon Sep 17 00:00:00 2001 From: Gordon GECOS Date: Sat, 10 Dec 2022 10:36:36 -0500 Subject: countdown to show seconds left in year --- countdown.hs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/countdown.hs b/countdown.hs index 2a1f654..a7488de 100755 --- a/countdown.hs +++ b/countdown.hs @@ -289,11 +289,16 @@ countdownWidget showConversion isSimulated t = countdownBox = (borderWithLabel (str $ printf "Countdown %d" currentYear) $ vBox $ - (str $ printf "Day %d of %d\nSecond %s of %s" - dayNum - numDays - (commas $ (1 + toSeconds yearElapsed :: Int)) - (commas $ toSeconds yearLength)) : remains + let secondsNow = 1 + toSeconds yearElapsed :: Int + secondsTotal = toSeconds yearLength + in + (str $ printf "Day %d of %d\nSecond %s of %s\n%s seconds remain" + dayNum + numDays + (commas secondsNow) + (commas secondsTotal) + (commas $ secondsTotal - secondsNow) + ) : remains ) remains = [ -- cgit v1.2.3