summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@cryptonomic.net>2022-09-16 16:31:00 -0400
committerAndrew Cady <d@cryptonomic.net>2022-09-16 16:31:00 -0400
commit546ef7a58b57424a9c35ac6011672ced5f7852bc (patch)
tree62444ebc8dde513f951183bc98378d8a0429af3b
parent969412bea376b3ff70d60465d2c18a75aadc2e47 (diff)
more output tweaking
-rwxr-xr-xcountdown.hs25
1 files changed, 11 insertions, 14 deletions
diff --git a/countdown.hs b/countdown.hs
index 7f54920..63a41cd 100755
--- a/countdown.hs
+++ b/countdown.hs
@@ -207,19 +207,14 @@ countdownWidget isSimulated t =
207 str "\n" 207 str "\n"
208 <=> 208 <=>
209 hCenter (hBox [ 209 hCenter (hBox [
210 -- borderWithLabel (str $ printf "Progress through %d" currentYear) $ 210 vBox [ cosmicCalendarNext, str "\n", cosmicCalendarPrevious ],
211 -- (str $ printf "Day %d of %d; %d remaining\nSecond %s of %s" 211 str " ",
212 -- dayNum 212 borderWithLabel (str "Cosmic Conversion") (hBox [cosmicConversion, cosmicConversion'])
213 -- numDays
214 -- (numDays - dayNum)
215 -- (commas $ (1 + toSeconds yearElapsed :: Int))
216 -- (commas $ toSeconds yearLength))
217 -- ,
218 str " "
219 ,
220 borderWithLabel (str "Cosmic Conversion") (hBox [cosmicConversion, cosmicConversion'])
221 ]) 213 ])
222 where 214 where
215 cosmicCalendarPrevious = borderWithLabel (str "Last on the Cosmic Calendar") (str " ")
216 cosmicCalendarNext = borderWithLabel (str "Next on the Cosmic Calendar") (str " ")
217
223 countdownBox = 218 countdownBox =
224 (borderWithLabel (str $ printf "Countdown %d" currentYear) $ 219 (borderWithLabel (str $ printf "Countdown %d" currentYear) $
225 (str $ printf "Day %d of %d; %d remaining\nSecond %s of %s" 220 (str $ printf "Day %d of %d; %d remaining\nSecond %s of %s"
@@ -261,9 +256,10 @@ countdownWidget isSimulated t =
261 256
262 cosmicTimeBox = 257 cosmicTimeBox =
263 (borderWithLabel (str "Cosmic Time") $ 258 (borderWithLabel (str "Cosmic Time") $
264 vBox [ (str $ printf "%s years ago" (commas $ (floor cosmicYearsAgo :: Integer))) 259 vBox [(str $ printf "%s years" (commas $ (floor cosmicYears :: Integer))),
265 , (str "\n") 260 str "\n",
266 , (str $ printf "%s years ago" (showLarge $ (realToFrac cosmicYearsAgo))) 261 (str $ printf "%s years ago" (commas $ (floor cosmicYearsAgo :: Integer)))
262 -- , (str $ printf "%s years ago" (showLarge $ (realToFrac cosmicYearsAgo)))
267 -- , (str $ printf "%s billion years ago" (commasF 9 $ cosmicYearsAgo / (1000*1000*1000))) 263 -- , (str $ printf "%s billion years ago" (commasF 9 $ cosmicYearsAgo / (1000*1000*1000)))
268 -- , (str $ printf "%s million years ago" (commasF 6 $ cosmicYearsAgo / (1000*1000))) 264 -- , (str $ printf "%s million years ago" (commasF 6 $ cosmicYearsAgo / (1000*1000)))
269 -- , (str $ printf "%s thousand years ago" (commasF 3 $ cosmicYearsAgo / 1000)) 265 -- , (str $ printf "%s thousand years ago" (commasF 3 $ cosmicYearsAgo / 1000))
@@ -271,6 +267,7 @@ countdownWidget isSimulated t =
271 ]) 267 ])
272 currentTimeBox = (hCenter (borderWithLabel (str $ printf "Current time%s" (if isSimulated then " (SIMULATED)" else "")) $ 268 currentTimeBox = (hCenter (borderWithLabel (str $ printf "Current time%s" (if isSimulated then " (SIMULATED)" else "")) $
273 padLeftRight 3 $ (str (formatTime defaultTimeLocale "%A, %B %e%n%Y-%m-%d %r" t)))) 269 padLeftRight 3 $ (str (formatTime defaultTimeLocale "%A, %B %e%n%Y-%m-%d %r" t))))
270 cosmicYears = realToFrac ageOfUniverseInYears * (realToFrac $ (yearElapsed // yearLength)) :: Rational
274 cosmicYearsAgo = realToFrac ageOfUniverseInYears * (realToFrac $ 1 - (yearElapsed // yearLength)) :: Rational 271 cosmicYearsAgo = realToFrac ageOfUniverseInYears * (realToFrac $ 1 - (yearElapsed // yearLength)) :: Rational
275 -- cosmicYearsAgo = if yearElapsed == yearLength 272 -- cosmicYearsAgo = if yearElapsed == yearLength
276 -- then 0 273 -- then 0