# `testing.FakeSession.now`

> Contract 2.0.0 · package sha256 `a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e` · generated from `testing.d.ts` by `services/onsite-scripter/scripts/build-contract-docs.mjs`; edit the source, not this file.

Method of [`testing.FakeSession`](testing.FakeSession.md) · stable · since 2.0.0

```ts
now(): number;
```

The fake's timeline, ms: the [`Frame.timeMs`](Frame.timeMs.md) a frame drawn at this moment reads, that is
`performance.now()` when the session was made plus the fake time ticked since. It moves only
with [`tick`](testing.FakeSession.tick.md). A test whose app measures time with its own `performance.now()` against
[`Frame.timeMs`](Frame.timeMs.md) (a press time, a timeout it checks in a hook) stubs `performance.now` with it,
so the two compare as on the runtime, and restores it after.

## Example

Imports: values (`has`, `validate`, the `Holo*Error` classes, the pure helpers) from `@holostep-configurators/runtime-client`, types from `@holostep-configurators/runtime-client/contract`, `/math` and `/testing` names from those entries; `boot` from the runtime module the root's `loadRuntimeAtFloor` resolves to. A type your page defines is your app's: declare it there, never import it from the package.

Compiled under the contract's strict settings (`examples/declaration/24-FakeSession.now.ts`):

```ts
import { createFakeSession } from '@holostep-configurators/runtime-client/testing';
import type { Session } from '@holostep-configurators/runtime-client/contract';
declare const session: Session;
declare const signal: AbortSignal;
const fake = createFakeSession({});
const realNow = performance.now;
performance.now = () => fake.now();                       // the app's clock follows tick()
try {
  let pressedAt: number | null = null;
  let held = 0;
  fake.onFrame((frame) => {
    if (pressedAt !== null) held = frame.timeMs - pressedAt;
  });
  fake.tick(1000);
  pressedAt = performance.now();                          // the app's own reading
  fake.tick(16);
  fake.frame();
  if (held !== 16) throw new Error('the app clock and Frame.timeMs drifted apart');
} finally {
  performance.now = realNow;
}
```

## Generic-API test (spec 3.1)

| Rule | Result |
| --- | --- |
| 1. Neutral name | pass: `now` names no product |
| 2. A precedent | not recorded: no ledger row (coverage.json) names this member or its owner |
| 3. Two apps, or labs | not recorded: no ledger row names this member or its owner |
| 4. The cheaper fix first | not recorded per member (Appendix B decides it per need) |
