diff options
author | Andrew Cady <d@cryptonomic.net> | 2022-09-17 01:25:56 -0400 |
---|---|---|
committer | Andrew Cady <d@cryptonomic.net> | 2022-09-17 01:25:56 -0400 |
commit | b668497fffa4845b9ab337f28b545f32c9964980 (patch) | |
tree | 94989b572339c85a9f0c9525df04a30c5fc94cfc | |
parent | 53e469c8b72c27eee1d534c374bfad3a0d743cd8 (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.hs | 4 |
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 | |||
69 | billionYears = (* (lengthOfYear * 1000 * 1000 * 1000)) . fromRational | 69 | billionYears = (* (lengthOfYear * 1000 * 1000 * 1000)) . fromRational |
70 | 70 | ||
71 | yearsAgo :: Rational -> NominalDiffTime | 71 | yearsAgo :: Rational -> NominalDiffTime |
72 | yearsAgo n = (ageOfUniverse - lengthOfYear * fromRational n) / ageOfUniverse * lengthOfYear | 72 | yearsAgo (fromRational -> n) = lengthOfYear' * (1 - (n / fromIntegral ageOfUniverseInYears)) |
73 | where | ||
74 | lengthOfYear' = 365 * lengthOfDay -- TODO: Countdown will be wrong day on leap years! | ||
73 | 75 | ||
74 | thousandYearsAgo :: Rational -> NominalDiffTime | 76 | thousandYearsAgo :: Rational -> NominalDiffTime |
75 | thousandYearsAgo = yearsAgo . (* 1000) | 77 | thousandYearsAgo = yearsAgo . (* 1000) |