summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2012-09-24 18:05:49 +0900
committerJasper Van der Jeugt <m@jaspervdj.be>2012-09-24 18:05:49 +0900
commitb11f07a11b92fa4b3eae093bdb0c33f53253aabd (patch)
tree6f4cb2a47437d1d8b6f4cbae5031b484cacb19fe /src
parentfe673bca7271fb901c4590affb395f6fba0ffd3d (diff)
downloadhakyll-b11f07a11b92fa4b3eae093bdb0c33f53253aabd.tar.gz
Conditionals in preview server
Diffstat (limited to 'src')
-rw-r--r--src/Hakyll/Web/Preview/Poll.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Hakyll/Web/Preview/Poll.hs b/src/Hakyll/Web/Preview/Poll.hs
index 83ec54a..69acdc6 100644
--- a/src/Hakyll/Web/Preview/Poll.hs
+++ b/src/Hakyll/Web/Preview/Poll.hs
@@ -1,5 +1,6 @@
-- | Interval-based implementation of preview polling
--
+{-# LANGUAGE CPP #-}
module Hakyll.Web.Preview.Poll
( previewPoll
) where
@@ -7,7 +8,11 @@ module Hakyll.Web.Preview.Poll
import Control.Applicative ((<$>))
import Control.Concurrent (threadDelay)
import Control.Monad (filterM)
+#if MIN_VERSION_directory(1,2,0)
+import Data.Time (getCurrentTime)
+#else
import System.Time (getClockTime)
+#endif
import System.Directory (getModificationTime, doesFileExist)
import Hakyll.Core.Configuration
@@ -18,7 +23,11 @@ previewPoll :: HakyllConfiguration -- ^ Configuration
-> IO [FilePath] -- ^ Updating action
-> IO () -- ^ Can block forever
previewPoll _ update = do
+#if MIN_VERSION_directory(1,2,0)
+ time <- getCurrentTime
+#else
time <- getClockTime
+#endif
loop time =<< update
where
delay = 1000000