Crate cronjob [] [src]

cronjob

The cronjob library lets you create cronjobs for your methods.

Getting started

extern crate cronjob;
use cronjob::{CronJob, get_timezone_offset};

fn main() {
    // Create offset for your required timezone.
    let offset = get_timezone_offset(2);
    // Create the `CronJob` object.
    let mut cron = CronJob::new("Test Cron", "* * * * * * *", offset, on_cron);
    // Start the cronjob
    cron.start_job();
}

// Our cronjob handler
fn on_cron(name: &str) {
    println!("{}: It's time!", name);
}

Structs

CronJob

The object to create and execute cronjobs for yout application.

Functions

get_timezone_offset

Use this to automaticly get an FixedOffset for the CronJob object