86. time: the shell times a command
Raised 2026-08-03, prompted by timing a forty-minute proof run on the host. This OS had no way to
ask the same question. It shipped the same day it was written up (crates/swish,
components/src/swish.rs, kernel/src/user/time_tests.rs, notes/time-command.md). It reads the
shell's clock as the block below leans. It is proven at a real prompt on both ISAs through
script/swish-check. The status row was left behind by that merge and is corrected here. That
is the drift milestone 93 (documentation audits as a mechanism) exists to catch: the work landed, and the roadmap kept saying it had not
started. The lane raised one question against its own block: whether a duration needs a clock
capability at all. It is open and does not unbuild anything.
time wc log.txt runs the command exactly as typed and reports how long it took. The name is the
standard term and stays. time, nice and env are the prefix-word idiom caps <command> already
cites as its precedent. This is the second prefix word, so the grammar it needs is proven in the
shell rather than new. The tail is a real command through the same RunSpec/plan_against path.
That keeps "what you time is what you run" true the same way caps keeps it for inspection.
The one design question is whose clock it is, and the leaning is the shell's. date established
the clock story. It is a read-only clock-page mapping, endowed, with an honest refusal when the
holder has none. If time reads the shell's own clock capability, a child that holds no clock at
all can still be timed. That is the Unix behavior: the timed program does not know it is being timed
and needs nothing to permit it. Timing is then something an observer does with its own authority.
That is the capability-model answer too, since the child's wall-clock duration is observable to
anyone who can watch it start and stop. The alternative, delegating a clock to the child, would make
time a grant and change what the child can do. That is a different tool. Decide it on the record
in design/decisions/ when built. This block records the leaning and the reason.
What the number means is bounded by what the shell can see. It is wall clock between spawn and the
exit arriving on the supervision endpoint, on the clock page's resolution. Not CPU time, which is
the scheduler's knowledge and unqueried today. If that arrives later it is an extension of the same
command, not a rival. A worked EXAMPLES entry and the resolution caveat go in the man-page-shaped
docs, per the FreeBSD standard.
Scope note
Timing a command that holds no clock is the whole point. So the milestone includes the case where
the shell holds no clock either. The refusal should be date's, worded for the prefix position.
Host tests cover the plan and the arithmetic. The QEMU test is one timed spawn asserting the
duration is positive and sane. It is not a latency benchmark, which is bench's job.
Follow-on
- Decision.
design/decisions/0072-time-command-clock.mdtakes the question this block left open, whether a duration needs a clock capability at all. The answer is counter-onlytime. Wall-clock identity is authority and a capability gates it, while a duration is ambient, because the ABI already opened the counter to EL0. Both clock refusals became unreachable rather than tolerated. - Refused. CPU time. It is the scheduler's knowledge and nothing queries it today. The number this command reports is deliberately wall clock between spawn and the exit arriving on the supervision endpoint. If CPU time ever arrives it is an extension of the same command rather than a rival to it. This refusal is milestone 490 (design/roadmap/0490-cpu-time-in-time.md), which carries it with the condition that would change it.
- Milestone 93. The status row still said the work had not started after it merged. That is the roadmap drift 93 turned into a cadence rather than a one-off correction.
Index row
The second prefix-word command after caps, so the grammar is proven, and date already built
the clock story. The design question was whose clock it is: the shell's. So a child that holds no
clock capability can still be timed, which is the Unix behavior and what shipped