on master help sign in
Conditionals in preview server
commitb11f07a11b92fa4b3eae093bdb0c33f53253aabd authorJasper Van der Jeugt <m@jaspervdj.be> dateMon 24 Sep 2012, 18:05 (14 years ago) parentfe673bc
1 file changed+9
src/Hakyll/Web/Preview/Poll.hs+9
src/Hakyll/Web/Preview/Poll.hs+9
@@ -1,5 +1,6 @@
11-- | Interval-based implementation of preview polling
22--
3+{-# LANGUAGE CPP #-}
34module Hakyll.Web.Preview.Poll
45 ( previewPoll
56 ) where
@@ -7,7 +8,11 @@ module Hakyll.Web.Preview.Poll
78import Control.Applicative ((<$>))
89import Control.Concurrent (threadDelay)
910import Control.Monad (filterM)
11+#if MIN_VERSION_directory(1,2,0)
12+import Data.Time (getCurrentTime)
13+#else
1014import System.Time (getClockTime)
15+#endif
1116import System.Directory (getModificationTime, doesFileExist)
1217
1318import Hakyll.Core.Configuration
@@ -18,7 +23,11 @@ previewPoll :: HakyllConfiguration -- ^ Configuration
1823 -> IO [FilePath] -- ^ Updating action
1924 -> IO () -- ^ Can block forever
2025previewPoll _ update = do
26+#if MIN_VERSION_directory(1,2,0)
27+ time <- getCurrentTime
28+#else
2129 time <- getClockTime
30+#endif
2231 loop time =<< update
2332 where
2433 delay = 1000000