> For the complete documentation index, see [llms.txt](https://docs.augelab.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.augelab.com/function-blocks/blocks-reference/input-output/outputs-exports/cycle-timer.md).

# Cycle Timer

This function block measures the time elapsed between consecutive evaluations and provides that duration as a numeric value. It is useful for profiling steps, measuring loop or event periods, and monitoring runtime performance in real time.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

This function block does not have any inputs.

## 📤 Outputs <a href="#outputs" id="outputs"></a>

`Seconds` This output provides the elapsed time (in seconds) since the previous evaluation. On the very first evaluation after placement or reset, the output will be zero.

## 🕹️ Controls <a href="#controls" id="controls"></a>

`No Controls` This block has no user-facing controls. It automatically updates its internal timestamp each time it runs.

## ⚙️ Running mechanism <a href="#running-mechanism" id="running-mechanism"></a>

* Each time the block is evaluated in the scenario, it compares the current time with the time recorded on the previous evaluation and returns their difference as `Seconds`.
* The first evaluation acts as an initialization and returns zero since there is no previous timestamp.
* Because the block measures elapsed wall-clock time, it provides high-resolution timing suitable for measuring short intervals between steps or events.

## 🎯 Features <a href="#features" id="features"></a>

* Lightweight, automatic interval measurement without configuration.
* High-resolution timing ideal for profiling and cycle monitoring.
* Immediate availability of values for downstream processing or logging.

## 📝 Usage Instructions <a href="#usage" id="usage"></a>

1. Place the block in your scenario wherever you want to measure elapsed time between evaluations.
2. Read the `Seconds` output in downstream blocks to log, analyze or trigger actions based on elapsed time.
3. Remember that the first measurement after placement or reset returns zero.

Common combinations:

* Use with `Rising Edge` or `Logic Input` to measure time between discrete events or user-triggered actions.
* Use with image sources like `Camera USB`, `Stream Reader` or `Video` to measure frame intervals or processing latency.
* Feed the output to `Round` for a cleaner numeric presentation, or to `Scope` to display a live plot of cycle times.
* Send values to `CSV Export` or `Image Logger` for recording cycle time history.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* To monitor processing stability, pipe `Seconds` into `Scope` to visualize jitter and spikes over time.
* For long-term logging, use `CSV Export` to collect cycle times for offline analysis.
* When measuring between manual actions, combine with `Keyboard/Barcode Reader` or `Logic Input` to capture precise event-to-event durations.
* If you need a formatted display, use `Round` to reduce decimal places before showing values in UI blocks.

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* If you always see zero values, verify that the scenario is actually running repeatedly and not frozen; the first evaluation after placement or reset will be zero by design.
* If measurements show unexpected very small intervals, ensure the block is not being evaluated multiple times per logical step by other flow constructs. Consider using an event trigger (for example `Rising Edge`) so the block measures only at intended moments.
* To reduce noisy spikes in short-term measurements, smooth or average several consecutive `Seconds` values using downstream processing or by logging and post-processing.
