Permalink
Browse files

Conditionals in preview server

  • Loading branch information...
jaspervdj committed Sep 24, 2012
1 parent fe673bc commit b11f07a11b92fa4b3eae093bdb0c33f53253aabd
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/Hakyll/Web/Preview/Poll.hs
@@ -1,13 +1,18 @@
-- | Interval-based implementation of preview polling
--
+{-# LANGUAGE CPP #-}
module Hakyll.Web.Preview.Poll
( previewPoll
) where
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

0 comments on commit b11f07a

Please sign in to comment.