Skip to content

Event: implement timeStamp instead of always returning 0#34894

Open
robobun wants to merge 3 commits into
mainfrom
farm/d9be4262/event-timestamp
Open

Event: implement timeStamp instead of always returning 0#34894
robobun wants to merge 3 commits into
mainfrom
farm/d9be4262/event-timestamp

test: relax timeStamp bounds for clock-derivation skew; normalize ins…

6c528ca
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 21, 2026 in 19m 13s

Code review found 1 potential issue

Found 1 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/jsc/bindings/ZigGlobalObject.cpp:3382-3384 m_timeOrigin derivation reads fake-timer-overridden clock

Annotations

Check warning on line 3384 in src/jsc/bindings/ZigGlobalObject.cpp

See this annotation in the file changed.

@claude claude / Claude Code Review

m_timeOrigin derivation reads fake-timer-overridden clock

`Bun__readOriginTimer` short-circuits to `vm.overridden_performance_now` when `jest.useFakeTimers()` is active, so if the first `performance`/`event.timeStamp` access happens under fake timers, `m_timeOrigin` is derived from the fake offset instead of real elapsed time and every `event.timeStamp` is permanently skewed — even after `useRealTimers()`. The comment on line 3381 states the intended invariant; the helper doesn't guarantee it. Add/use a raw export that reads `vm.origin_timer.elapsed()`