Skip to content
Back

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-timer
MCP
Thinking·
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-timer
Rust
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

PropTypeDefaultDescription
staterequiredAgentState—The agent state.
elapsedrequiredDuration—Working time from the run clock (`AgentMachine::elapsed`).
variantString"units"`units` · `clock` · `summary` · `meter`.
packString"neutral"Built-in pack id for the summary phrase.
meterRunMeterDefault::default()Counters for the `meter` variant.
sizef3213.0Font size in px.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
—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 Armed so 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:00 rolls three wheels in a short cascade.
  • Magnitude change (59s → 1m 00s, 9:59 → 10:00, 59:59 → 1:00:00): the slot widens with spring.snap 200 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 Done event time; after the verb's past-tense roll (dur.tense.roll 240 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
TransitionDurationDelayEasing / springStaggerFrame rate
Timer appear120 ms fadeat 1.0 sease.out—30 Hz
Tick (swap)instant———1 Hz
Digit roll (rolling variants)280 ms (dur.digit.roll)—ease.out30 ms right → left30 Hz during roll, else 1 Hz
Odometer mask18 % top/bottom fade————
Slot widen at magnitude change200 msbefore the rollspring.snap—60 Hz
Counter count-up50 ms ticks, 25 % of gap, min +1———20 Hz while moving
tok/s display updateevery 500 msafter 1.5 s streamingswap—2 Hz
Pause glyph in / out120 ms—ease.out / ease.in—30 Hz
Tone to secondary on pause200 ms—ease.out—30 Hz
Done: freeze → summary240 msafter the verb rollease.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 timer100 ms resolution———10 Hz while the step row is visible
Reduced motiondigits 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—linearnone1 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 meter if 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; Clock grows to 27:02:33; Units switches to 1d 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.6k correction rolls once; cost follows with est. 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 / meter tooltip, 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 ElapsedTimer from oxyn_dioxus and include STATUS_TEXT_CSS plus the token stylesheet once.
  • A GPUI version exists: ElapsedTimerEl in oxyn_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.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI