aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Compat/Directory.hs
blob: 61dd5c52531157ca40c73755e92914a3e19b59f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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