hledger, hledger-lib: support GHC 7.6

This commit is contained in:
Simon Michael 2012-10-08 16:52:07 +00:00
parent f441bbd946
commit c1ab41f0a9
3 changed files with 18 additions and 5 deletions

View File

@ -17,7 +17,7 @@ maintainer: Simon Michael <simon@joyful.com>
homepage: http://hledger.org
bug-reports: http://code.google.com/p/hledger/issues
stability: beta
tested-with: GHC==7.0.4, GHC==7.2.2, GHC==7.4.1
tested-with: GHC==7.0.4, GHC==7.2.2, GHC==7.4.1, GHC==7.6.1
cabal-version: >= 1.8
build-type: Simple
-- data-dir: data

View File

@ -1,4 +1,4 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ScopedTypeVariables, CPP #-}
{-|
Utilities for top-level modules and ghci. See also Hledger.Read and
@ -34,6 +34,10 @@ import System.Process (readProcessWithExitCode)
import System.Time (ClockTime, getClockTime, diffClockTimes, TimeDiff(TimeDiff))
import Test.HUnit
import Text.Printf
#if __GLASGOW_HASKELL__ >= 706
import System.Time (ClockTime(TOD))
import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds)
#endif
import Hledger.Cli.Options
import Hledger.Data
@ -98,8 +102,17 @@ journalSpecifiedFileIsNewer Journal{filereadtime=tread} f = do
fileModificationTime :: FilePath -> IO ClockTime
fileModificationTime f
| null f = getClockTime
| otherwise = getModificationTime f `C.catch` \(_::C.IOException) -> getClockTime
| otherwise = (do
#if __GLASGOW_HASKELL__ < 706
clo <- getModificationTime f
#else
utc <- getModificationTime f
let nom = utcTimeToPOSIXSeconds utc
let clo = TOD (read $ show nom) 0 -- XXX
#endif
return clo
)
`C.catch` \(_::C.IOException) -> getClockTime
-- | Attempt to open a web browser on the given url, all platforms.
openBrowserOn :: String -> IO ExitCode
openBrowserOn u = trybrowsers browsers u

View File

@ -18,7 +18,7 @@ maintainer: Simon Michael <simon@joyful.com>
homepage: http://hledger.org
bug-reports: http://code.google.com/p/hledger/issues
stability: beta
tested-with: GHC==7.0.4, GHC==7.2.2, GHC==7.4.1
tested-with: GHC==7.0.4, GHC==7.2.2, GHC==7.4.1, GHC==7.6.1
cabal-version: >= 1.8
build-type: Simple
-- data-dir: data