Skip to main content

CronParseTask

Return a timestamp from a crontab instruction.

Input: None

Returns: A timestamp

Example: Return the unix timestamp for the on-chain SYSCLOCK

{
"cronParseTask": {
"cronPattern": "* * * * * *",
"clockOffset": 0,
"clock": "SYSCLOCK"
}
}

Example: Return the unix timestamp for next friday at 5pm UTC

{
"cronParseTask": {
"cronPattern": "0 17 * * 5",
"clockOffset": 0,
"clock": 0
}
}

See the CronParseTask typescript definition in @switchboard-xyz/common

Fields

NameTypeDescription
 cronPattern

string

The cron pattern to parse.

 clockOffset

int32

The timestamp offset to calculate the next run.

 clock

Use the TaskRunner’s clock or the on-chain SYSCLOCK.

Enums

 ClockType

ValueNameDescription
 0ORACLE

Use the TaskRunners system clock for the current time.

 1SYSCLOCK

Use the on-chain SYSCLOCK for the current time.