From 0173b5f4ff1bb1aa07b15c441533a309036c8864 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 9 Mar 2013 21:38:43 +0000 Subject: ghc-7.6: allow directory-1.2 Get rid of old-time depend (and ClockTime in favour of UTCTime). time-compat helps to retain backward compatibility with directory-1.1 and lower. --- src/server/Cache.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/server/Cache.hs') diff --git a/src/server/Cache.hs b/src/server/Cache.hs index c99f212e3..d704fe495 100644 --- a/src/server/Cache.hs +++ b/src/server/Cache.hs @@ -4,11 +4,12 @@ import Control.Concurrent.MVar import Data.Map (Map) import qualified Data.Map as Map import System.Directory (getModificationTime) -import System.Time (ClockTime) +import Data.Time (UTCTime) +import Data.Time.Compat (toUTCTime) data Cache a = Cache { cacheLoad :: FilePath -> IO a, - cacheObjects :: MVar (Map FilePath (MVar (Maybe (ClockTime, a)))) + cacheObjects :: MVar (Map FilePath (MVar (Maybe (UTCTime, a)))) } newCache :: (FilePath -> IO a) -> IO (Cache a) @@ -27,7 +28,7 @@ readCache c file = Nothing -> do v <- newMVar Nothing return (Map.insert file v objs, v) -- Check time stamp, and reload if different than the cache entry - readObject m = do t' <- getModificationTime file + readObject m = do t' <- toUTCTime `fmap` getModificationTime file x' <- case m of Just (t,x) | t' == t -> return x _ -> cacheLoad c file -- cgit v1.2.3