Permalink
Browse files

Compatibility of cabal-install with GHC 7.4

  • Loading branch information...
phischu committed Aug 16, 2012
1 parent af03614 commit 630c79b9b23454a0e49cc8ce4f7e5fc3760281e4
Showing with 11 additions and 11 deletions.
  1. +7 −7 cabal-install/Distribution/Client/IndexUtils.hs
  2. +4 −4 cabal-install/Distribution/Client/Tar.hs
@@ -74,8 +74,8 @@ import System.IO.Error (isDoesNotExistError)
import Distribution.Compat.Exception (catchIO)
import System.Directory
( getModificationTime, doesFileExist )
-import Data.Time.Clock
- ( getCurrentTime, diffUTCTime )
+import System.Time
+ ( getClockTime, diffClockTimes, normalizeTimeDiff, TimeDiff(tdDay) )
getInstalledPackages :: Verbosity -> Compiler
@@ -189,15 +189,15 @@ readRepoIndex verbosity repo =
return mempty
else ioError e
- isOldThreshold = 15 * 24 *60 * 60 --seconds
+ isOldThreshold = 15 --days
warnIfIndexIsOld indexFile = do
indexTime <- getModificationTime indexFile
- currentTime <- getCurrentTime
- let diff = diffUTCTime currentTime indexTime
- when (diff >= isOldThreshold) $ case repoKind repo of
+ currentTime <- getClockTime
+ let diff = normalizeTimeDiff (diffClockTimes currentTime indexTime)
+ when (tdDay diff >= isOldThreshold) $ case repoKind repo of
Left remoteRepo -> warn verbosity $
"The package list for '" ++ remoteRepoName remoteRepo
- ++ "' is " ++ show diff ++ " seconds old.\nRun "
+ ++ "' is " ++ show (tdDay diff) ++ " days old.\nRun "
++ "'cabal update' to get the latest list of available packages."
Right _localRepo -> return ()
@@ -87,8 +87,8 @@ import Distribution.Compat.FilePerms
( setFileExecutable )
import System.Posix.Types
( FileMode )
-import Data.Time.Clock.POSIX
- ( utcTimeToPOSIXSeconds )
+import System.Time
+ ( ClockTime(TOD) )
import System.IO
( IOMode(ReadMode), openBinaryFile, hFileSize )
import System.IO.Unsafe (unsafeInterleaveIO)
@@ -899,5 +899,5 @@ recurseDirectories base (dir:dirs) = unsafeInterleaveIO $ do
getModTime :: FilePath -> IO EpochTime
getModTime path = do
- t <- getModificationTime path
- return $! truncate (utcTimeToPOSIXSeconds t)
+ TOD t _ <- getModificationTime path
+ return $! fromIntegral t

0 comments on commit 630c79b

Please sign in to comment.