[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Schedule](https://evolu.dev/docs/api-reference/common/Schedule) › windowed

```ts
function windowed(interval: Duration): Schedule<number>;
```

Defined in: [packages/common/src/Schedule.ts:504](https://github.com/evoluhq/evolu/blob/037c390af081e9944d616ff298a729515c5c5ab7/packages/common/src/Schedule.ts#L504)

Divides the timeline into fixed windows and sleeps until the next boundary.

Similar to [fixed](https://evolu.dev/docs/api-reference/common/Schedule/functions/fixed), but skips missed recurrences and always sleeps until
the next window boundary. Outputs the repetition count.

Useful for aligning executions to regular intervals from the first step.

### Aligning to time windows

```ts

const stepAfter = (elapsed: "3s" | "7s") => {
  const deps = testCreateDeps();
  const step = windowed("5s")(deps);
  step(undefined);
  deps.time.advance(elapsed);
  return step(undefined);
};

// At 3s the next boundary is 2s away; at 7s it is 3s away.
assertOk(stepAfter("3s"), [1, 2000]);
assertOk(stepAfter("7s"), [1, 3000]);
```