> For the complete documentation index, see [llms.txt](https://minwork.gitbook.io/react-interval-hook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://minwork.gitbook.io/react-interval-hook/advanced/options/configuration/self-correction.md).

# Self correction

#### Name

`selfCorrecting`

#### Type

`boolean`

#### Default value

`true`

#### Description

Self correct time intervals between subsequent [callback](/react-interval-hook/advanced/callback.md) invocations to reflect actual time elapsed.

*setTimeout* and *setInterval* are not precise ([explanation](https://stackoverflow.com/questions/29971898/how-to-create-an-accurate-timer-in-javascript/29972322#29972322)) which make them unusable in their basic form for functionalities that strictly depend on precise timing (like clocks, timers or time based events).

This option helps eliminating that problem by depending on absolute timestamps and auto adjusting time between each [interval](/react-interval-hook/advanced/interval.md).

If you disable that option you will get same behaviour as using barebone *setInterval* but still using the advantage of [control methods](/react-interval-hook/advanced/hook-result-controls.md).

#### Example / Explanation

Let's say you set [interval](/react-interval-hook/advanced/interval.md) to 1000 ms. Internally it will set *setTimeout(..., 1000)*.

But then it turns out that *setTimeout* actually took *1005 ms* to call [callback](/react-interval-hook/advanced/callback.md) instead of *1000 ms*. Now the self correction kicks in and the next *setTimeout* will be automatically set to *995 ms* to compensate for a *5 ms* drift.

This process will be repeated every *interval*.&#x20;

But what if *setTimeout* take *5000 ms* instead of *1005 ms*? \
Not to worry, this case can be handled in [callback](/react-interval-hook/advanced/callback.md) by using *ticks* to indicate how many *intervals* has passed since last *callback*.
