aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Compat
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2014-07-26 23:52:40 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2014-07-27 00:36:23 +0100
commit9e4604fa0b20b12177fe1f24650e4dfaf388e33a (patch)
treeaa766a51032a10512bd0eac0310600e7e4e6bb3e /src/Text/Pandoc/Compat
parent00cb9836b8da773cb6bbe18b6d12944c04bcf3e9 (diff)
downloadpandoc-9e4604fa0b20b12177fe1f24650e4dfaf388e33a.tar.gz
Added compatability layer to support directory-1.1
Diffstat (limited to 'src/Text/Pandoc/Compat')
-rw-r--r--src/Text/Pandoc/Compat/Directory.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Compat/Directory.hs b/src/Text/Pandoc/Compat/Directory.hs
new file mode 100644
index 000000000..61dd5c525
--- /dev/null
+++ b/src/Text/Pandoc/Compat/Directory.hs
@@ -0,0 +1,21 @@
+{-# LANGUAGE CPP #-}
+module Text.Pandoc.Compat.Directory ( getModificationTime )
+ where
+
+#if MIN_VERSION_directory(1,2,0)
+import System.Directory
+
+
+#else
+import qualified System.Directory as S
+import Data.Time.Clock (UTCTime)
+import Data.Time.Clock.POSIX
+import System.Time
+
+getModificationTime :: FilePath -> IO UTCTime
+getModificationTime fp = convert `fmap` S.getModificationTime fp
+ where
+ convert (TOD x _) = posixSecondsToUTCTime (realToFrac x)
+
+#endif
+