Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

system

Wall and monotonic clocks, pushed once a second until configure sets the interval.

mantle.system:configure({ interval = 60 }) -- the text below shows no seconds

text {
    content = mantle.system:map(function(system)
        return system and os.date("%a %H:%M", system.time) or ""
    end),
}

State

mantle.system:get() returns SystemState, nil before the first push. A field marked ? may be absent.

mantle.system’s payload, pushed on each tick of interval.

FieldTypeDescription
monotonicintegerSeconds since system was first used, as of the last push; excludes suspend. Take durations from it, since NTP moves time.
timeintegerUnix epoch seconds, as os.date takes them.

Actions

Call each as mantle.system:<action>(arguments...); ? marks an argument you may omit.

ActionArgumentsDescription
configuresettings: SystemConfigureSets the push interval, 1 second until this. Each push lands on a wall-clock multiple of it, and one lands at once.

SystemConfigure

system:configure’s table. An absent interval keeps the current one.

FieldTypeDescription
interval?integerSeconds between pushes, each on a multiple of it since the epoch, so 60 lands on every minute; 1 is the default and 0 stops them.

Backend

The Supervisor’s own clocks; nothing external. Pushes land on wall-clock multiples of interval since the epoch (default 1): 60 lands on each minute’s :00; 3600 on UTC hours, not local ones in a half-hour timezone. A push due during suspend lands on resume, and a clock step (NTP, settimeofday) pushes at once and re-aligns. 0 stops pushes; time and monotonic keep their last values. The interval lives in the Supervisor, so it outlasts reloads until the next configure, and every reader shares it.

See also: Clock bar recipe.

Source: supervisor/src/capabilities/system/