Elapsed timer
How long the agent has worked, without the time it spent waiting for you: units, a clock, a past-tense summary or a meter with tokens, speed and cost.
oxyn add elapsed-timerThinking·
Dioxus
rsx! {
ElapsedTimer {
state: machine.state().clone(),
elapsed: machine.elapsed(clock.now()) // excludes time waiting for you,
size: 15.0,
}
}Rendered from Rust at build time · goes live when visible
When to use
- "How long has it been, and what is it costing?" is the second question after "is it alive?".
- A ticking number reassures during long runs, lets the user decide when to stop, and becomes the receipt when the run ends.
- The studied apps: Codex shows Working (12s • esc to interrupt) with the format 0s … 59s, 1m 00s, 1h 00m 00s and pauses the timer while an approval is open; Claude Code counts tokens up smoothly after 30 s and ends with "{verb} for 1m 23s"; Warp rests as ∷ 5s • 0.5 credits; Roo ticks seconds on its reasoning block; OpenCode ships a 560 ms odometer (AnimatedNumber); Zed spaces numbers with a thin space and a figure dash (all note 08).
- Elsewhere: a cost total ticking $0.05 → $0.46 [R030], a test timer 2.9 → 10.6 s with counters [R037], a time budget "2h 06m of 24h" [R007], "Thinking 13s" → "Thought for 14s" [R021], and counters that roll on a widget bento [R018].
When not to use
- The verb that says what the agent is doing, rotating through a verb pack while it works and settling into the past tense when it finishes: use Verb cycler instead.
- How full the context window is: use Context meter instead.
- An agent asks before it acts: use Approval Card instead.
Installation
Elapsed timer is free and MIT. The oxyn CLI copies its code, and the components it needs, into src/oxyn/ of your Dioxus or GPUI project, so it is yours to change.
Terminal
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add elapsed-timerRust
use crate::oxyn::{ElapsedTimer, STATUS_TEXT_CSS};Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{ElapsedTimer, STATUS_TEXT_CSS};
Usage
Dioxus · rust
rsx! {
ElapsedTimer {
state: machine.state().clone(),
elapsed: machine.elapsed(clock.now()) // excludes time waiting for you,
size: 15.0,
}
}Examples
Units
12s, 1m 04s.
Thinking·
Code
rsx! {
ElapsedTimer {
state: machine.state().clone(),
elapsed: machine.elapsed(clock.now()) // excludes time waiting for you,
size: 15.0,
}
}Clock
0:12.
Thinking·
Code
rsx! {
ElapsedTimer {
state: machine.state().clone(),
elapsed: machine.elapsed(clock.now()) // excludes time waiting for you,
variant: "clock",
size: 15.0,
}
}Summary
Worked for 12s.
Thinking·
Code
rsx! {
ElapsedTimer {
state: machine.state().clone(),
elapsed: machine.elapsed(clock.now()) // excludes time waiting for you,
variant: "summary",
size: 15.0,
}
}Meter
Tokens, speed and cost.
Thinking·
Code
rsx! {
ElapsedTimer {
state: machine.state().clone(),
elapsed: machine.elapsed(clock.now()) // excludes time waiting for you,
variant: "meter",
meter: RunMeter { tokens: Some((14_200, false)), tok_per_s: Some(41.6), cost_usd: Some((0.07, false)) },
size: 15.0,
}
}API reference
ElapsedTimer
| Prop | Type | Default | Description |
|---|---|---|---|
staterequired | AgentState | — | The agent state. |
elapsedrequired | Duration | — | Working time from the run clock (`AgentMachine::elapsed`). |
variant | String | "units" | `units` · `clock` · `summary` · `meter`. |
pack | String | "neutral" | Built-in pack id for the summary phrase. |
meter | RunMeter | Default::default() | Counters for the `meter` variant. |
size | f32 | 13.0 | Font size in px. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| — | Not focusable |
Accessibility
- Never announced per second; the label reads in spelled units ("Elapsed 1 minute 12 seconds").
- Time spent waiting for you is left out, and said so ("paused while waiting for you").
From the spec
- The timer uses
role="timer"(implicitly not live). It is never announced per second. - Accessible label, computed when read: "Elapsed 1 minute 12 seconds" (spelled units, not "1m 12s"); paused: "Elapsed 1 minute 12 seconds, paused while waiting for you".
- Opt-in milestone announcements (polite) at 30 s, 1 min, then every 2 min (family rule, status-text.md §11). Done summary announced once ("Done, worked for 1 minute 12 seconds").
- Counters (tokens, cost, tok/s) are not live; their accessible text is the formatted value with units spelled ("18 thousand 200 tokens, estimated").
- Contrast: digits ≥ 4.5:1 in every state, including paused (secondary tone token is contrast-checked) and budget warning tones (which also add an icon and text, never colour alone).
- Reduced motion: §6 last row. Rolling, flipping and segment animations are decorative; the value is always readable in its final form on the same frame.
- Focus: not in tab order unless the host is actionable (summary that expands, budget chip).
Motion & interaction
- Appear. At 1 s the timer fades in (120 ms) in its reserved slot — the slot exists from
Armedso nothing shifts (Width::ReserveMagnitude, status-text.md §2.2). - Tick. Once per second, aligned to the run's whole seconds. Default variants swap digits; rolling variants roll only the digits that change, right to left, 30 ms stagger, so
0:59 → 1:00rolls three wheels in a short cascade. - Magnitude change (
59s → 1m 00s,9:59 → 10:00,59:59 → 1:00:00): the slot widens withspring.snap200 ms *before* the new digits roll in. - Count-up counters. Tokens and cost move toward their target, closing 25 % of the gap per 50 ms tick (min +1 unit) — the status strip's rule; a correction downward (estimate → real) rolls *down* once (280 ms), never silently.
- Interrupted roll. If a new value arrives mid-roll, the wheel continues from its current position to the new target (no queue of rolls).
- Pause. Digits stop; ⏸ fades in 120 ms beside them; digits shift to the secondary text tone (still ≥ 4.5:1). Resume: ⏸ fades out, counting continues from the paused value (no catch-up jump).
- Done. Final value freezes at the
Doneevent time; after the verb's past-tense roll (dur.tense.roll240 ms), digits re-flow into the summary phrase ("1:12" → "Worked for 1m 12s"); counters settle to their final values in ≤ 300 ms. - Hover. Tooltip: "Started 14:02 · 1 min 12 s working · waited 1 min 04 s" (local time).
Timing
| Transition | Duration | Delay | Easing / spring | Stagger | Frame rate |
|---|---|---|---|---|---|
| Timer appear | 120 ms fade | at 1.0 s | ease.out | — | 30 Hz |
| Tick (swap) | instant | — | — | — | 1 Hz |
| Digit roll (rolling variants) | 280 ms (dur.digit.roll) | — | ease.out | 30 ms right → left | 30 Hz during roll, else 1 Hz |
| Odometer mask | 18 % top/bottom fade | — | — | — | — |
| Slot widen at magnitude change | 200 ms | before the roll | spring.snap | — | 60 Hz |
| Counter count-up | 50 ms ticks, 25 % of gap, min +1 | — | — | — | 20 Hz while moving |
| tok/s display update | every 500 ms | after 1.5 s streaming | swap | — | 2 Hz |
| Pause glyph in / out | 120 ms | — | ease.out / ease.in | — | 30 Hz |
| Tone to secondary on pause | 200 ms | — | ease.out | — | 30 Hz |
| Done: freeze → summary | 240 ms | after the verb roll | ease.out | — | 60 Hz |
| Counter settle on done | ≤ 300 ms | — | ease.out | — | 30 Hz |
| Budget countdown tint (80 % / 95 %) | 300 ms | — | ease.out | — | 30 Hz |
| Decimal step timer | 100 ms resolution | — | — | — | 10 Hz while the step row is visible |
| Reduced motion | digits swap without rolling; counters jump to the value at most every 500 ms; pause glyph appears without fade; summary replaces the timer with an 80 ms crossfade | — | linear | none | 1 Hz |
Responsive behaviour
- units and clock fit a status row; meter needs room for three counters.
Edge cases (spec)
- 0 s / under 1 s. Nothing shown, no summary; counters may still show in
meterif non-zero. - Exactly at boundaries. 59.6 s shows
59s(floor, never round up to a minute early). - Very long runs (hours, days). Compact hosts drop seconds from 1 h;
Clockgrows to27:02:33;Unitsswitches to1d 03h. - RTL. Digit groups and durations sit in an LTR bidi isolate; the unit labels follow the locale; the slot mirrors with the line.
- CJK. Narrow unit forms (
1時間2分); full-width digits are never used (tabular Latin or the locale's numbering system). - Locale digits. Arabic-Indic or Devanagari digits keep tabular cells measured from that digit set.
- Fonts without
tnum. Fixed digit cells (status-text.md §2.3). - Screen width. Priority when space runs out: elapsed > tokens > cost > tok/s > TTFT; dropped segments move into the tooltip.
- Clock skew / sleep. Local monotonic clock for live counting; resumed runs use server start time; negative skew clamps to 0; after device sleep the timer jumps to the true value without rolling.
- Background tab. Repaint at 0.25 Hz; value always computed from timestamps, so it is correct on focus.
- Estimated vs real tokens.
~18k→17.6kcorrection rolls once; cost follows withest.removed. - No usage events at all. Tokens and cost hidden (never show 0); tok/s hidden.
- Parallel sub-agents. Parent timer is wall time of the parent run; child totals summed in the
breakdown/metertooltip, labelled "agent time" so it can exceed wall time without confusion. - Paused across a reload. Pause intervals live in
RunClock, so a reload during an approval still shows the paused value.
Notes for AI
- Import
ElapsedTimerfromoxyn_dioxusand includeSTATUS_TEXT_CSSplus the token stylesheet once. - A GPUI version exists:
ElapsedTimerElinoxyn_gpui. - Props to set first:
state,elapsed. - It reads a clock (
now) for live timers; pass one clock for the whole page rather than one per component. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.