From 563497c8b6f194415faf5cb0e97040cc1db0695c Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Thu, 22 Sep 2022 00:29:03 -0400 Subject: fix "cosmic time ago" display (partially) --- countdown.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/countdown.hs b/countdown.hs index b64b685..0d072e1 100755 --- a/countdown.hs +++ b/countdown.hs @@ -264,14 +264,19 @@ countdownWidget showConversion isSimulated t = hCenter $ txt calSubtitle, str "\n", hBox [ - str $ formatTime defaultTimeLocale "%A, %B %e%n%Y-%m-%d %r" $ calBeginTime `addLocalTime` yearStart t, + let cosmicSecondsAgo = nominalDiffTimeToSeconds (yearEnd cosmicCalendarT `diffLocalTime` cosmicCalendarT) + cosmicCalendarT = calBeginTime `addLocalTime` yearStart t + in vBox [ + str $ formatTime defaultTimeLocale "%A, %B %e%n%Y-%m-%d %r" $ cosmicCalendarT, + -- TODO: Choose correct cosmic unit + str $ printf "%s cosmic second%s ago" (commasF' 1 cosmicSecondsAgo) (pluralize cosmicSecondsAgo) + ], padLeft Max $ vBox [ str $ showLarge years ++ " years", str $ printf "%s years ago" $ showLarge $ realToFrac (ageOfUniverseInYears - floor years) ] ], -- str $ printf "%s years ago" (commas $ ageOfUniverseInYears - floor years), - str $ printf "%s years ago" $ showLarge $ realToFrac (ageOfUniverseInYears - floor years), if not short then str "\n" <=> -- cgit v1.2.3