Permalink
Browse files

Switch to using the time package, rather than old-time

  • Loading branch information...
igfoo committed Jan 14, 2012
1 parent 601172f commit d0cab4bb327910a341bc99f4e8539806bd671a11
Showing with 9 additions and 11 deletions.
  1. +8 −10 System/Directory.hs
  2. +1 −1 directory.cabal
View
@@ -105,7 +105,10 @@ import Foreign.C
{-# CFILES cbits/directory.c #-}
-import System.Time ( ClockTime(..) )
+import Data.Time
+#ifndef mingw32_HOST_OS
+import Data.Time.Clock.POSIX
+#endif
#ifdef __GLASGOW_HASKELL__
@@ -986,23 +989,18 @@ The operation may fail with:
-}
-getModificationTime :: FilePath -> IO ClockTime
+getModificationTime :: FilePath -> IO UTCTime
getModificationTime name = do
#ifdef mingw32_HOST_OS
-- ToDo: use Win32 API
withFileStatus "getModificationTime" name $ \ st -> do
modificationTime st
#else
stat <- Posix.getFileStatus name
- let mod_time :: Posix.EpochTime
+ let mod_time :: Posix.EpochTime
mod_time = Posix.modificationTime stat
- dbl_time :: Double
- dbl_time = realToFrac mod_time
- return (TOD (round dbl_time) 0)
+ return $ posixSecondsToUTCTime $ realToFrac mod_time
#endif
- -- For info
- -- round :: (RealFrac a, Integral b => a -> b
- -- realToFrac :: (Real a, Fractional b) => a -> b
#endif /* __GLASGOW_HASKELL__ */
@@ -1023,7 +1021,7 @@ withFileOrSymlinkStatus loc name f = do
throwErrnoIfMinus1Retry_ loc (lstat s p)
f p
-modificationTime :: Ptr CStat -> IO ClockTime
+modificationTime :: Ptr CStat -> IO UTCTime
modificationTime stat = do
mtime <- st_mtime stat
let dbl_time :: Double
View
@@ -33,7 +33,7 @@ Library {
if impl(ghc >= 7.1)
extensions: NondecreasingIndentation
build-depends: base >= 4.2 && < 4.5,
- old-time >= 1.0 && < 1.1,
+ time < 1.5,
filepath >= 1.1 && < 1.3
if !impl(nhc98) {
if os(windows) {

0 comments on commit d0cab4b

Please sign in to comment.