# Room: tick property

> The tick read-only property of the Room interface counts the ticks the room has run.

The **`tick`** read-only property of the [`Room`](/docs/reference/room-api/room) interface is the number of ticks the room has run.

## Value

A number.

- It's 0 in `onCreate`.
- Inside the stepper and `onTick`, it's the number of the tick running, 1 for a new room's first.
- Between ticks, in `onJoin`, `onMessage`, `onLeave` and `onRequest`, it's the number of the last tick run. Writes made there go out with tick `room.tick + 1`.

## Description

`tick` is kept in room state, so it carries on across hibernation and crashes. Ticks stop while a room is hibernated, so it doesn't count time spent hibernated.

> [!NOTE]
> The client's `room.tick` is the tick of the last state update it applied, which is behind the room's.

## Examples

### Ending a round after a number of ticks

A round that lasts 60 seconds at 20 ticks per second ends exactly 1200 ticks after it starts.

```ts
// round.ts
import { defineRoom } from "@irtio/room";

export default defineRoom({
  tickRate: 20,
  data: () => ({ endsAt: 0 }),
  onCreate(room) {
    room.data.endsAt = room.tick + 1200;
  },
  onTick(room) {
    if (room.tick === room.data.endsAt) room.broadcast({ type: "round-over" });
  },
});
```

## See also

- [Ticks](/docs/reference/room-sdk#ticks)
- [Timers across hibernation](/docs/hibernation#timers-across-hibernation)
