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