time
Look up time.interval, time.wait, time.now, and time.format, the timers and the clock of an Arc automation.
The time module has timers and the clock. Import it with import time. interval and
wait are flow functions: a function body cannot call them.
The period and duration parameters have the type i64 ns. They take a literal, such
as 500ms or 10hz, or a variable of type i64 ns. A variable declared as
hold := 5s has the type i64 s, and gives error ARC3002 expected i64 ns, got i64 s.
Declare it with the type:
import time
hold i64 ns := 5s
sequence fire {
time.wait(duration=hold) => next
1 -> ign_cmd
}
true => fireA literal of 0 or less is a compile error, such as period must be positive, got 0s. A
variable that becomes 0 or less stops the timer and reports an error. On the Core the
error is a warning. On a Driver it stops the automation.
format
Prints a timestamp as text, in UTC or a time zone.
inputi64 nsRequiredThe timestamp to print.
formatstr = ""The format of the text, from the codes below. An empty format gives ISO 8601, such as
2026-03-07T15:04:05.25Z.tzstr = ""The time zone, such as
America/Denver. Defaults to UTC.
- Trigger -> optional. Each new trigger runs it, whatever the value. With no trigger, it
runs when
inputhas a new value. - Output -> the text, as a
str. - Function form ->
time.format(input, format, tz) str.
import time
true => time.format(time.now(), "%Y-%m-%d %H:%M:%S %Z", "America/Denver") -> start_msg Format codes
A format holds plain text and codes. Each code prints one part of the time. The examples
are for 2026-03-07T15:04:05.25Z.
Time zones
A time zone takes any IANA name, case insensitive.
The examples are %H:%M %Z for 2026-03-07T15:04:05Z.
interval
Fires again and again, once each period.
periodi64 nsRequiredThe time between two fires.
- Trigger -> optional. The first trigger starts the timer, and later values have no effect. With no trigger, the timer starts when its stage starts.
- Output ->
u8value 1 on each fire, with the time of the cycle. - Runs -> on the first timer cycle after the timer starts, then on a fixed schedule,
once each
period. A late fire does not move the next one. When a cycle takes longer thanperiod, the timer fires once and does not make up the fires that it missed. At the top level, it fires when the automation starts.
import time
time.interval(period=1s) -> heartbeatnow
Gives the current time.
- Trigger -> optional. Each new trigger runs it, whatever the value. With no trigger, it runs once each time its stage starts.
- Output -> the time as a timestamp, type
i64 ns. Write it to atimestampchannel or ani64channel. Another channel type, such asf64, is an error. - Function form ->
time.now(). All calls in the same cycle give the same time.
now has no parameters.
import time
true => time.now() -> start_timewait
Fires once, after duration.
durationi64 nsRequiredThe time to wait.
- Trigger -> optional. The first trigger starts the timer, and later values have no effect. With no trigger, the timer starts when its stage starts.
- Output ->
u8value 1, once, with the time of the cycle. - Runs -> when
durationhas passed since the timer started. It counts from zero again each time its stage starts. As a sequence step, the sequence moves on when it fires.
import time
sequence fire {
1 -> ign_cmd
time.wait(duration=2s) => next
1 -> press_vlv_cmd
}
true => fireThe timers follow the same rules on the Core and on a Driver. They never fire early. How soon after its deadline a timer fires depends on where the automation runs and its performance level. See Arc timing.