packages feed

hxt-cache 9.0.2.1 → 9.1.0

raw patch · 2 files changed

+14/−12 lines, 2 filesdep +timedep −old-timedep ~directory

Dependencies added: time

Dependencies removed: old-time

Dependency ranges changed: directory

Files

hxt-cache.cabal view
@@ -1,8 +1,11 @@ Name:           hxt-cache-Version:        9.0.2.1+Version:        9.1.0 Synopsis:       Cache for HXT XML Documents and other binary data Description:    Extension for caching XML documents and other binary data in cache directory-                of the local filesystem.+                of the local filesystem+                .+                Changes from 9.0.2: dependency of old-time changed to time, dependecy of directory changed to >=1.2 to work with ghc-7.6+                . License:        OtherLicense License-file:   LICENSE Author:         Uwe Schmidt@@ -34,11 +37,11 @@                 binary     >= 0.5 && < 1,                 containers >= 0.2 && < 1,                 deepseq    >= 1.1 && < 2,-                directory  >= 1   && < 1.2,+                directory  >= 1.2 && < 2,                 filepath   >= 1.1 && < 2,                 hxt        >= 9   && < 10,                 old-locale >= 1   && < 2,-                old-time   >= 1   && < 2,+                time       >= 1.4 && < 2,                 unix       >= 2.3 && < 3,                 SHA        >= 1.4 && < 2 
src/Text/XML/HXT/Arrow/XmlCache.hs view
@@ -39,13 +39,14 @@ import Data.Either import Data.Maybe import Data.Digest.Pure.SHA+import Data.Time  import System.FilePath import System.Directory import System.IO import System.Locale import System.Posix                            ( touchFile )-import System.Time+-- import System.Time import System.IO.Unsafe                        ( unsafePerformIO )  import Text.XML.HXT.Core@@ -208,7 +209,7 @@                                                  )                           ]         where-        fmtTime         = formatCalendarTime defaultTimeLocale rfc822DateFormat . toUTCTime+        fmtTime         = formatTime defaultTimeLocale rfc822DateFormat  -- ------------------------------------------------------------ @@ -276,7 +277,7 @@ -- Just Nothing  : cache hit, cache data valid: use cache data -- Just (Just t) : cache hit, but cache data out of date: get document conditionally with if-modified-since t -cacheHit                :: Int -> FilePath -> IO (Maybe (Maybe ClockTime))+cacheHit                :: Int -> FilePath -> IO (Maybe (Maybe UTCTime)) cacheHit age cf         = ( try' $                             do                             e <- doesFileExist cf@@ -284,15 +285,13 @@                               then return Nothing                               else do                                    mt <- getModificationTime cf-                                   ct <- getClockTime-                                   return . Just $ if (dt `addToClockTime` mt) >= ct+                                   ct <- getCurrentTime+                                   return . Just $ if (dt `addUTCTime` mt) >= ct                                                    then Nothing                                                    else Just mt                           ) >>= return . either (const Nothing) id     where-    seconds             = age `mod` 60-    minutes             = age `div` 60-    dt                  = normalizeTimeDiff $ TimeDiff 0 0 0 0 minutes seconds 0+    dt                  = fromInteger . toInteger $ age  try'                    :: IO a -> IO (Either SomeException a) try'                    = try