← All docs
hrtime() — internals
Compiler internals for hrtime(): lowering path, type checks, and runtime helpers.
hrtime() — internals
Where it lives
- Signature:
src/builtins/system/hrtime.rs - Lowering:
src/codegen/lower_inst/builtins/system.rs:247 (lower_hrtime) - Function symbol:
lower_hrtime()
Lowering notes
- Lowers
hrtime([$as_number])through the monotonic-clock runtime helper. __rt_hrtimereads the as-number flag from the integer result register (x0/rax) and returns- an already-boxed
Mixedresult — a boxed[sec, nsec]array when the flag is0/false, or a - boxed nanosecond integer when truthy — so no post-call boxing is needed. Unlike the timestamp
- builtins the omitted-argument default is
0(array form), not the-1current-time sentinel.
Runtime helpers
The following runtime helpers are referenced:
__rt_hrtime__rt_http_response_code
Signature summary
function hrtime(bool $as_number = false): mixed
What the type checker enforces
- Arity: takes 0–1 arguments (1 optional).
Eval interpreter (magician)
- Declaration:
crates/elephc-magician/src/interpreter/builtins/time/hrtime.rs(eval_builtin!) - Dispatch hooks:
direct,values