cron 0.2.4 → 0.2.5
raw patch · 4 files changed
+26/−2 lines, 4 filesdep ~timePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: time
API changes (from Hackage documentation)
Files
- changelog +4/−0
- cron.cabal +4/−1
- src/System/Cron/Parser.hs +5/−0
- src/System/Cron/Schedule.hs +13/−1
changelog view
@@ -1,3 +1,7 @@+# 0.2.5+* GHC 7.10 support+# 0.2.4+* Bugfixes for new task runner feature # 0.2.3 * Add new in-process task runner feature. Credit to @AndrewRademacher # 0.2.2
cron.cabal view
@@ -1,5 +1,5 @@ Name: cron-Version: 0.2.4+Version: 0.2.5 Description: Cron data structure and Attoparsec parser. The idea is to embed it in larger systems which want to roll their own scheduled tasks in a format that people@@ -21,6 +21,9 @@ Build-Type: Simple Stability: experimental Tested-With: GHC == 7.4.1+ , GHC == 7.6.3+ , GHC == 7.8.3+ , GHC == 7.10.1 Cabal-Version: >= 1.8 Extra-Source-Files: README.md
src/System/Cron/Parser.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE CPP #-} -------------------------------------------------------------------- -- | -- Module : System.Cron.Parser@@ -27,7 +28,11 @@ import System.Cron +#if !MIN_VERSION_base(4,8,0) import Control.Applicative (pure, (*>), (<$>), (<*), (<*>), (<|>))+#else+import Control.Applicative ((<$>), (<|>))+#endif import Data.Char (isSpace) import Data.Attoparsec.Text (Parser) import qualified Data.Attoparsec.Text as A
src/System/Cron/Schedule.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE CPP #-} -------------------------------------------------------------------- -- |@@ -43,7 +44,9 @@ , execSchedule ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative+#endif import Control.Concurrent import Control.Monad.Except import Control.Monad.Identity@@ -53,8 +56,17 @@ import Data.Time import System.Cron import System.Cron.Parser+#if !MIN_VERSION_time(1,5,0) import System.Locale+#endif +readTime' :: TimeLocale -> String -> String -> UTCTime+#if MIN_VERSION_time(1,5,0)+readTime' = parseTimeOrError True+#else+readTime' = readTime+#endif+ {- Scheduleing monad -} data Job = Job CronSchedule (IO ())@@ -109,7 +121,7 @@ let f = formatTime defaultTimeLocale fmtFront now m = (read (formatTime defaultTimeLocale fmtMinutes now) :: Int) + 1 r = f ++ ":" ++ if length (show m) == 1 then "0" ++ show m else show m- next = readTime defaultTimeLocale fmtRead r :: UTCTime+ next = readTime' defaultTimeLocale fmtRead r :: UTCTime diff = diffUTCTime next now delay = round (realToFrac (diff * 1000000) :: Double) :: Int return (next, delay)