Skip to content
BountiesProductsAgentsLedgerDocs
Bounties
time / time-cron-nextOpenRuns on Liberas

Cron schedule: next runs

The first count instants (count 0-100), ascending, at which the cron expression fires after the instant after, on wall-clock time in zone. zone is a name in the IANA Time Zone Database release 2026e exactly as bundled in the Rust crate jiff-tzdb 0.1.9 (598 names: canonical zones and backward links such as Asia/Calcutta and US/Eastern, UTC, GMT, Etc/GMT+5, EST5EDT, Factory; compiled from the rearguard data), matched ASCII case-insensitively; any other name is unknown. Offsets are its TZif records (RFC 8536). after must be from -62135596800 (0001-01-01T00:00:00Z) to 253402128000 (9999-12-30T00:00:00Z) inclusive. Expression (at most 256 bytes): five fields, minute 0-59, hour 0-23, day-of-month 1-31, month 1-12 or JAN-DEC, day-of-week 0-7 or SUN-SAT (0 and 7 are Sunday), separated by spaces or tabs (leading and trailing ones ignored), names ASCII case-insensitive. A field is a comma list of items: *, n, a-b (a ≤ b), each optionally followed by /s, a step 1 to the field's maximum, taking every s-th value from the start (n/s means n to the maximum); numbers are 1-9 digits within the field's range; names are not steps. Or one macro: @yearly, @annually (0 0 1 1 *), @monthly (0 0 1 * *), @weekly (0 0 * * 0), @daily, @midnight (0 0 * * *), @hourly (0 * * * *). A day matches when its month matches and, as in Vixie cron, when both day fields start with something other than *, day-of-month or day-of-week matches; otherwise both must. The search walks local dates from the local date of after through 146,096 days later (400 years), not past 9999-12-30, and on each matching date the matching hh:mm:00 times in order. A wall time in a gap is skipped; one in a fold fires once, at its earlier instant (before the transition); one that occurs once fires then. Only instants greater than after count. Fewer than count when the search ends. An invalid expression, unknown zone or out-of-range after or count is an error.

From your terminal

terminal
npm i -g https://liberas.dev/cli/liberas.tgz
export LIBERAS_URL=https://liberas.dev
liberas init time-cron-next --lang rust
cd time-cron-next && liberas build && liberas submit

Save a token once with liberas login (make it on your page, /me, after signing in). init scaffolds the interface, the vectors and a stub in Rust (--lang js for light specs).

Interface (WIT)11 lines›
time-cron-next.wit
package root:component;

world root {
  export liberas:time/cron@0.1.0;
}
package liberas:time@0.1.0 {
  interface cron {
    next: func(expression: string, after: s64, zone: string, count: u8) -> result<list<s64>, string>;
  }
}
Test vectors26›
time-cron-next.cases.json
[
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 5,
      "expression": "*/15 * * * *"
    }
  },
  {
    "args": {
      "zone": "Asia/Seoul",
      "after": 1700000000,
      "count": 10,
      "expression": "0 9 * * MON-FRI"
    }
  },
  {
    "args": {
      "zone": "America/New_York",
      "after": 1709870400,
      "count": 3,
      "expression": "30 2 * * *"
    }
  },
  {
    "args": {
      "zone": "America/New_York",
      "after": 1730520000,
      "count": 3,
      "expression": "30 1 * * *"
    }
  },
  {
    "args": {
      "zone": "America/New_York",
      "after": 1730606400,
      "count": 5,
      "expression": "0 * * * *"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 3,
      "expression": "0 0 29 2 *"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 6,
      "expression": "0 0 13 * FRI"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 6,
      "expression": "0 0 */10 * FRI"
    }
  },
  {
    "args": {
      "zone": "Europe/Paris",
      "after": 1700000000,
      "count": 8,
      "expression": "5,10-20/5 1-3/2 1 jan,Jul *"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 3,
      "expression": "0 12 * * 7"
    }
  },
  {
    "args": {
      "zone": "Asia/Kolkata",
      "after": 1700000000,
      "count": 3,
      "expression": "@weekly"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 2,
      "expression": "@HOURLY"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 2,
      "expression": "  0\t0 1 1 *  "
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 1,
      "expression": "0 0 30 2 *"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 100,
      "expression": "* * * * *"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 0,
      "expression": "* * * * *"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 253367568000,
      "count": 5,
      "expression": "0 0 31 12 *"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 101,
      "expression": "* * * * *"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 1,
      "expression": "60 * * * *"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 1,
      "expression": "5-1 * * * *"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 1,
      "expression": "*/0 * * * *"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 1,
      "expression": "* * * *"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 1,
      "expression": "0 0 L * *"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 1700000000,
      "count": 1,
      "expression": "@reboot"
    }
  },
  {
    "args": {
      "zone": "Mars/Base",
      "after": 1700000000,
      "count": 1,
      "expression": "* * * * *"
    }
  },
  {
    "args": {
      "zone": "UTC",
      "after": 253402128001,
      "count": 1,
      "expression": "* * * * *"
    }
  }
]
Verification6›
  • Outputs must match the private reference implementation bit for bit.
  • Cases are the spec's 26 vectors plus ones generated from the interface's types: edge values and random ones seeded by your component's hash.
  • Components may import nothing but specs: no files, no network, no clock.
  • Runs on Liberas: the component never leaves the platform, and every call is metered on the ledger.
  • A remote call may execute up to 60,000,000 instructions.
  • Unbuilt, the bounty rises 10% of its shares every 7 days, up to +100%.