diff --git a/src/Handler/Health.hs b/src/Handler/Health.hs index ca41fe686..3fe2a4437 100644 --- a/src/Handler/Health.hs +++ b/src/Handler/Health.hs @@ -13,8 +13,6 @@ import qualified Data.Set as Set import Control.Concurrent.STM.Delay -import Language.Haskell.TH (stringE,runIO) - -- import Data.FileEmbed (embedStringFile) getHealthR :: Handler TypedContent @@ -123,15 +121,13 @@ getStatusR = do Uptime: #{show $ ddays starttime currtime} days.
Compile Time
- #{comptime} #
- $maybe ctime <- readMay comptime
- Build age: #{show $ ddays ctime currtime} days.
+ #{show cTime} #
+ Build age: #{show $ ddays cTime currtime} days.
|]
where
- -- vnr_full :: Text = $(embedStringFile "nix/docker/version.json") -- nix/ files not accessible during container construction
+ -- vnr_full :: Text = $(embedStringFile "nix/docker/version.json") -- nix/ files not accessible during container construction
+ cTime :: UTCTime
+ cTime = $compileTime
- comptime :: Text
- comptime = $(stringE =<< runIO (show <$> getCurrentTime))
-
ddays :: UTCTime -> UTCTime -> Double
ddays tstart tstop = (/100) $ fromIntegral $ round $ diffUTCTime tstop tstart / (36 * 24)
diff --git a/src/Utils/DateTime.hs b/src/Utils/DateTime.hs
index f97596ef3..b7963f128 100644
--- a/src/Utils/DateTime.hs
+++ b/src/Utils/DateTime.hs
@@ -3,6 +3,7 @@
module Utils.DateTime
( timeLocaleMap
, TimeLocale(..)
+ , compileTime
, currentYear
, HasLocalTime(..)
, DateTimeFormat(..)
@@ -79,6 +80,11 @@ timeLocaleMap extra@((_, defLocale):_) = do
letE [localeMap'] (varE localeMap)
+compileTime :: ExpQ -- Type UTCTime
+compileTime = do
+ now <- runIO getCurrentTime
+ [e|now|]
+
currentYear :: ExpQ
currentYear = do
now <- runIO getCurrentTime