Skip to content

Passing UTCTime to Job #31

@joehealy

Description

@joehealy

Thanks in advance of my request for a really useful scheduling library.

Is there any scope to extend cron so that the time it has been scheduled for is passed to the job?

Ie so the Job definition becomes something like:

data Job = Job CronSchedule (UTCTime -> IO ())

This way, systems relying on cron can be tested independently of the current wall clock time...
I realise this would break plenty of code, but maybe there is a way to add it without doing so?

Maybe something like:

data Job = Job CronSchedule (IO ())
| JobWithTime CronSchedule (UTCTime -> IO ())

I'm using a fork at https://github.com/joehealy/cron/tree/pass_time_to_jobs to achieve this, but without the backwards compatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions