[commit: directory] master: Switch to using the time package, rather than old-time (d0cab4b)
Ian Lynagh
igloo at earth.li
Sat Jan 14 20:37:14 CET 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/directory
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/d0cab4bb327910a341bc99f4e8539806bd671a11
>---------------------------------------------------------------
commit d0cab4bb327910a341bc99f4e8539806bd671a11
Author: Ian Lynagh <igloo at earth.li>
Date: Sat Jan 14 17:07:40 2012 +0000
Switch to using the time package, rather than old-time
>---------------------------------------------------------------
System/Directory.hs | 16 +++++++---------
directory.cabal | 2 +-
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/System/Directory.hs b/System/Directory.hs
index e6287f9..d6e84eb 100644
--- a/System/Directory.hs
+++ b/System/Directory.hs
@@ -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,7 +989,7 @@ The operation may fail with:
-}
-getModificationTime :: FilePath -> IO ClockTime
+getModificationTime :: FilePath -> IO UTCTime
getModificationTime name = do
#ifdef mingw32_HOST_OS
-- ToDo: use Win32 API
@@ -996,13 +999,8 @@ getModificationTime name = do
stat <- Posix.getFileStatus name
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
diff --git a/directory.cabal b/directory.cabal
index f6b239c..2d3be18 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 < 1.5,
filepath >= 1.1 && < 1.3
if !impl(nhc98) {
if os(windows) {
More information about the Cvs-libraries
mailing list