From f54b178d2b9dfa4be79b2f841262acba58c1eb5a Mon Sep 17 00:00:00 2001
From: Ian Lynagh <igloo@earth.li>
Date: Sat, 22 Oct 2011 18:34:25 +0100
Subject: [PATCH] Use time (POSIXTime) rather than old-time (ClockTime)

---
 System/Directory.hs |   20 +++++++-------------
 directory.cabal     |    2 +-
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/System/Directory.hs b/System/Directory.hs
index 6d16dfd..4497268 100644
--- a/System/Directory.hs
+++ b/System/Directory.hs
@@ -105,7 +105,8 @@ import Foreign.C
 
 {-# CFILES cbits/directory.c #-}
 
-import System.Time             ( ClockTime(..) )
+import Data.Time.Clock
+import Data.Time.Clock.POSIX
 
 #ifdef __GLASGOW_HASKELL__
 
@@ -980,7 +981,7 @@ The operation may fail with:
 
 -}
 
-getModificationTime :: FilePath -> IO ClockTime
+getModificationTime :: FilePath -> IO POSIXTime
 getModificationTime name = do
 #ifdef mingw32_HOST_OS
  -- ToDo: use Win32 API
@@ -988,15 +989,10 @@ getModificationTime name = 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 $ realToFrac mod_time
 #endif
-   -- For info
-   -- round :: (RealFrac a, Integral b => a -> b
-   -- realToFrac :: (Real a, Fractional b) => a -> b
 
 #endif /* __GLASGOW_HASKELL__ */
 
@@ -1017,12 +1013,10 @@ withFileOrSymlinkStatus loc name f = do
         throwErrnoIfMinus1Retry_ loc (lstat s p)
 	f p
 
-modificationTime :: Ptr CStat -> IO ClockTime
+modificationTime :: Ptr CStat -> IO POSIXTime
 modificationTime stat = do
     mtime <- st_mtime stat
-    let dbl_time :: Double
-        dbl_time = realToFrac (mtime :: CTime)
-    return (TOD (round dbl_time) 0)
+    return $ realToFrac (mod_time :: CTime)
     
 isDirectory :: Ptr CStat -> IO Bool
 isDirectory stat = do
diff --git a/directory.cabal b/directory.cabal
index f6b239c..6cdc451 100644
--- a/directory.cabal
+++ b/directory.cabal
@@ -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,
                    filepath >= 1.1 && < 1.3
     if !impl(nhc98) {
       if os(windows) {
-- 
1.7.2.5

