# Timer

### Overview

The **Timer Component** triggers at a specified interval, sending periodic messages based on the configured time delay. The first message is sent immediately when the flow starts, followed by scheduled ticks at regular intervals.

### Usage

This component is used for time-based automation, such as polling, scheduling, and recurring execution in workflows.

#### Output Ports

| Port  | Description                              |
| ----- | ---------------------------------------- |
| `out` | Emits a message at the defined interval. |

**Output Properties**

| Property   | Type      | Description                                              |
| ---------- | --------- | -------------------------------------------------------- |
| `lastTick` | `string`  | The last execution time (ISO 8601 format).               |
| `now`      | `string`  | The current execution time (ISO 8601 format).            |
| `elapsed`  | `integer` | Time elapsed (in milliseconds) since the last execution. |

#### Properties

| Property   | Type      | Description                                       |
| ---------- | --------- | ------------------------------------------------- |
| `interval` | `integer` | Execution interval in minutes (min 5, max 35000). |

#### Processing Logic

1. **Immediate Trigger**: Sends an initial message immediately upon starting the flow.
2. **Recurring Execution**: The timer schedules and emits messages at the defined interval.
3. **Crash Recovery**: Ensures messages are not lost in case of system restarts by handling state recovery.

### Notes

* **Minimum Interval**: The smallest allowed interval is 5 minutes.
* **Ensured Execution**: The component ensures that a tick is processed, even after a system restart.
* **Long Interval Support**: Supports intervals up to 35000 minutes (approximately 24 days).

This component is ideal for workflows requiring periodic execution, such as polling APIs, running background tasks, or time-based automation.
