cron

Generated by tinox doc

tinox.core.cron, bundled with the compiler and also available as a standalone tinox-central package.

Parse and match

import tinox.core.cron
import tinox.core.time
class Main
{
    fnc main() -> Int32
    {
        // every day at 09:00
        const expr: CronExpr = Cron::parse("0 9 * * *")
        const now: Int64 = Time::now()
        println("matches now: " + Cron::matches(expr, now).toString())
        println("next run at: " + Cron::nextRun(expr).toString())
        return 0
    }
}

class Cron

Methods

fn parse(expr: String) → CronExpr
fn nextRun(expr: CronExpr) → Int64
fn nextMinute(current: Int64, field: String) → Int64
fn getCurrentMinute(sec: Int64) → Int64
fn matches(expr: CronExpr, timestamp: Int64) → Bool

class CronExpr

Fields

minuteString
hourString
dayOfMonthString
monthString
dayOfWeekString

class CronJob

Fields

exprCronExpr
callbackfnc() -> Nothing
lastRunInt64

class CronScheduler

Fields

jobsList<CronJob>
runningBool

Methods

fn new() → CronScheduler
fn addJob(scheduler: CronScheduler, expr: String, callback: fnc() -> Nothing) → Nothing
fn start(scheduler: CronScheduler) → Nothing
fn stop(scheduler: CronScheduler) → Nothing
fn tick(scheduler: CronScheduler) → Nothing