packages feed

clock-extras 0.1.0.1 → 0.1.0.2

raw patch · 2 files changed

+17/−7 lines, 2 filesdep ~basedep ~clockPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, clock

API changes (from Hackage documentation)

Files

clock-extras.cabal view
@@ -1,6 +1,7 @@ name:                clock-extras-version:             0.1.0.1+version:             0.1.0.2 synopsis:            A couple functions that probably should be in the 'clock' package+description:         A couple functions that probably should be in the 'clock' package, such as 'elapsedTime' and 'diffSeconds'. license:             BSD3 license-file:        LICENSE author:              Jonathan Fischoff@@ -14,8 +15,8 @@ library   hs-source-dirs:      src   exposed-modules:     System.Clock.TimeIt-  build-depends: base  >= 4.7 && < 5-               , clock >= 0.7.1 && < 0.8.0+  build-depends: base  >= 4.6 && < 5+               , clock >= 0.4.6 && < 0.8.0   default-language:    Haskell2010   ghc-options:         -Wall 
src/System/Clock/TimeIt.hs view
@@ -1,18 +1,27 @@-{-| A couple functions that probably should be in the 'clock' package. +{-# LANGUAGE CPP, ViewPatterns #-}+{-| A couple functions that probably should be in the 'clock' package.     See this issue: https://github.com/corsis/clock/issues/42 -} module System.Clock.TimeIt where import System.Clock +#if !MIN_VERSION_clock(0,7,0)+-- This code is ripped out of System.Clock 0.7.1+s2ns :: Num a => a+s2ns = 10^(9 :: Int)++toNanoSecs :: TimeSpec -> Integer+toNanoSecs   (TimeSpec  (toInteger -> s) (toInteger -> n)) = s * s2ns + n+#endif -- | Time an action. Return the elasped time the result elapsedTime :: IO a -> IO (a, Double) elapsedTime action = do-  startTime <- getTime Monotonic +  startTime <- getTime Monotonic   r <- action-  endTime   <- getTime Monotonic +  endTime   <- getTime Monotonic    let result = diffSeconds endTime startTime-               +   return (r, result)  -- | Subtract two TimeSpecs and return the result in seconds