aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2012-09-21 10:41:04 -0400
committerBen Gamari <bgamari.foss@gmail.com>2012-09-21 15:43:26 -0400
commita96982e701e69730e6f5b1117b38f8ee4fef1276 (patch)
treeee493347508fb7a474be27b448a6fb6419137f24
parentbb4ea9d422fd2c17dc709cb4fcdfb93d42532eb5 (diff)
downloadpandoc-a96982e701e69730e6f5b1117b38f8ee4fef1276.tar.gz
Setup: getModificationTime returns UTCTime as of GHC 7.6
-rw-r--r--Setup.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/Setup.hs b/Setup.hs
index 6d039823e..e3980624a 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
import Distribution.Simple
import Distribution.Simple.Setup
(copyDest, copyVerbosity, fromFlag, installVerbosity, BuildFlags(..))
@@ -20,6 +22,7 @@ import System.Time
import System.IO.Error ( isDoesNotExistError )
import Data.Maybe ( catMaybes )
import Data.List ( (\\) )
+import Data.Time.Clock (UTCTime(..))
main :: IO ()
main = do
@@ -82,7 +85,11 @@ modifiedDependencies :: FilePath -> [FilePath] -> IO [FilePath]
modifiedDependencies file dependencies = do
fileModTime <- catch (getModificationTime file) $
\e -> if isDoesNotExistError e
+#if __GLASGOW_HASKELL__ >= 706
+ then return (UTCTime (toEnum 0) 0) -- the minimum ClockTime
+#else
then return (TOD 0 0) -- the minimum ClockTime
+#endif
else ioError e
depModTimes <- mapM getModificationTime dependencies
let modified = zipWith (\dep time -> if time > fileModTime then Just dep else Nothing) dependencies depModTimes