# Clock (/docs/sims/conditions/clock)



<DemoTabs ids="[&#x22;clock&#x22;]" />

`device.clock` moves the wall clock the app reads with `Date.now()`, so a 14-day trial can expire in one step. The real time comes back when the test ends or the lease is released.

```ts
await device.clock.advance("15d");
await device.clock.set("2027-01-01T00:00:00Z", { frozen: true }); // iOS only
await device.clock.during("2027-01-01T00:00:00Z", async () => { /* ... */ });
await device.clock.reset();
```

| Call                        | Does                                                             |
| --------------------------- | ---------------------------------------------------------------- |
| `advance(duration)`         | move the clock forward from now                                  |
| `set(instant, { frozen? })` | jump to an ISO instant; `frozen` holds it there (iOS only)       |
| `during(instant, fn)`       | run `fn` at that instant, then restore                           |
| `reset()`                   | back to the suite's `conditions.clock`, or real time without one |

Durations are milliseconds or `"10s"`, `"2m"`, `"2d"`. The wall clock moves; monotonic clocks do not, so timers and animations keep running.

## Per platform [#per-platform]

* **iOS:** the clock changes for an app launched with the network dylib (the same rule as the [network](/docs/sims/conditions/network#how-it-reaches-the-app)). A frozen clock holds the wall clock at one instant.
* **Android:** the emulator's clock changes. It cannot be frozen (`E_UNSUPPORTED`).

## Practice [#practice]

* A large offset breaks TLS: certificates look expired or not yet valid, so HTTPS fails while the clock is far from real time. Do not make requests in a spec that advances the clock by weeks.
* A JS timer armed while the clock was ahead waits for the shifted time once the clock goes back. Re-read the time on demand (the example's clock card has a Refresh button) or relaunch the app after `reset()`.

## In a suite [#in-a-suite]

```ts title="warden.config.ts"
conditions: { clock: { offset: "2d" } },
```

`clock` takes an ISO instant (it keeps running), `{ at, frozen? }` or `{ offset: "2d" }`. On iOS, declaring it launches every app with the dylib.

## By hand [#by-hand]

```bash
warden ui clock advance 15d
warden ui clock reset
```

See [warden ui](/docs/sims/ui) for every flag.

## Limitations [#limitations]

* A frozen clock is iOS only.
* HTTPS fails while the clock is far from real time.
