cron-0.4.0: Cron datatypes and Attoparsec parser

Safe HaskellNone
LanguageHaskell2010

System.Cron.Internal.Check

Synopsis

Documentation

nextMatch :: CronSchedule -> UTCTime -> Maybe UTCTime Source

Will return the next time from the given starting point where this schedule will match. Returns Nothing if the schedule will never match. Note that this function is not inclusive of the given time: the result will always be at least 1 minute beyond the given time. This is usually used to implement absolute timestamp schedulers. If you need to see multiple matches ahead, just keep feeding the result into nextMatch. Note that because nextMatch only returns Nothing on a schedule that will *never* be matched, it is safe to assume that if a schedule returns a Just once, it will always return a Just.

getDOW :: Day -> Int Source

ISO8601 maps Sunday as 7 and Monday as 1, we want Sunday as 0

expand :: CronSchedule -> Maybe Expanded Source

Guarantees: the Expanded will be satisfiable (no invalid dates, no empties). dow 7 will be normalized to 0 (Sunday)

fillTo :: (Int, Int) -> Int -> [Int] Source

hasValidForMonth Source

Arguments

:: Int

Month

-> EField 
-> Bool 

data Expanded Source

Constructors

Expanded 

Fields

minF :: EField
 
hourF :: EField
 
domF :: EField
 
monthF :: EField
 
dowF :: EField
 

Instances

scheduleMatches :: CronSchedule -> UTCTime -> Bool Source

Does the given cron schedule match for the given timestamp? This is usually used for implementing polling-type schedulers like cron itself.