summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@cryptonomic.net>2022-09-17 01:25:56 -0400
committerAndrew Cady <d@cryptonomic.net>2022-09-17 01:25:56 -0400
commitb668497fffa4845b9ab337f28b545f32c9964980 (patch)
tree94989b572339c85a9f0c9525df04a30c5fc94cfc
parent53e469c8b72c27eee1d534c374bfad3a0d743cd8 (diff)
ugly fix for calendar math
The calendar math actually needs to vary depending on whether it's a leap year. It currently cannot, because theCalendar is a pure value.
-rw-r--r--CosmicCalendar.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/CosmicCalendar.hs b/CosmicCalendar.hs
index 646d5bb..b439b48 100644
--- a/CosmicCalendar.hs
+++ b/CosmicCalendar.hs
@@ -69,7 +69,9 @@ billionYears :: Rational -> NominalDiffTime
69billionYears = (* (lengthOfYear * 1000 * 1000 * 1000)) . fromRational 69billionYears = (* (lengthOfYear * 1000 * 1000 * 1000)) . fromRational
70 70
71yearsAgo :: Rational -> NominalDiffTime 71yearsAgo :: Rational -> NominalDiffTime
72yearsAgo n = (ageOfUniverse - lengthOfYear * fromRational n) / ageOfUniverse * lengthOfYear 72yearsAgo (fromRational -> n) = lengthOfYear' * (1 - (n / fromIntegral ageOfUniverseInYears))
73 where
74 lengthOfYear' = 365 * lengthOfDay -- TODO: Countdown will be wrong day on leap years!
73 75
74thousandYearsAgo :: Rational -> NominalDiffTime 76thousandYearsAgo :: Rational -> NominalDiffTime
75thousandYearsAgo = yearsAgo . (* 1000) 77thousandYearsAgo = yearsAgo . (* 1000)