Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* maint:
  Improve information on timers
  • Loading branch information
rickard-green committed Nov 15, 2024
2 parents 2811f53 + 66b8c0b commit a6bc894
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 0 deletions.
17 changes: 17 additions & 0 deletions erts/doc/guides/time_correction.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,23 @@ offset, you get current Erlang system time.

To retrieve the current time offset, call `erlang:time_offset/0`.

### Timers

All timers are triggered relative Erlang monotonic time. All timers currently
have millisecond resolution both in the API and internally in the runtime
system. That is, resolution (as well as precision and accuracy) will not be
higher than millisecond. If [Erlang monotonic time](#erlang-monotonic-time) has
a lower resolution than millisecond, the timer resolution will be lower than
millisecond as well.

Timers can only be triggered on whole milliseconds since [the runtime
system start](`m:erlang#system_info_start_time`). A timer is not allowed to
trigger before the timeout time given by the user. That is, assuming that the
system is *not* heavily loaded, a timer will typically be triggered in the range
[`T`, `T+1`) milliseconds when the user has given the timeout time `T`. If the
system is heavily loaded, it may take an even longer time until a timer is
triggered.

## Introduction

Time is vital to an Erlang program and, more importantly, _correct_ time is
Expand Down
Binary file modified erts/preloaded/ebin/erlang.beam
Binary file not shown.
5 changes: 5 additions & 0 deletions erts/preloaded/src/erlang.erl
Original file line number Diff line number Diff line change
Expand Up @@ -5787,6 +5787,11 @@ See also [`erlang:send_after/4`](`send_after/4`),
[`erlang:cancel_timer/2`](`cancel_timer/2`), and
[`erlang:read_timer/2`](`read_timer/2`).
For more information on timers in Erlang in general, see the
[*Timers*](`e:erts:time_correction.md#timers`) section of the
[*Time and Time Correction in Erlang*](`e:erts:time_correction.md`)
ERTS User's guide.
Failure: `badarg` if the arguments do not satisfy the requirements specified
here.
""".
Expand Down
5 changes: 5 additions & 0 deletions lib/stdlib/src/timer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ module has been improved in OTP 25, making it more efficient and less
susceptible to being overloaded. See
[the Timer Module section in the Efficiency Guide](`e:system:commoncaveats.md#timer-module`).
For more information on timers in Erlang in general, see the
[*Timers*](`e:erts:time_correction.md#timers`) section of the
[*Time and Time Correction in Erlang*](`e:erts:time_correction.md`)
ERTS User's guide.
## Examples
_Example 1_
Expand Down
5 changes: 5 additions & 0 deletions system/doc/efficiency_guide/system_limits.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,8 @@ sufficiently unique.
If a unique integer is created each nano second, unique integers will be
reused at earliest after more than 584 years. That is, for the foreseeable future
they are sufficiently unique.

- ** Timer resolution ** - On most systems, millisecond resolution. For more
information, see the [*Timers*](`e:erts:time_correction.md#timers`) section of
the [*Time and Time Correction in Erlang*](`e:erts:time_correction.md`) ERTS
User's guide.
5 changes: 5 additions & 0 deletions system/doc/reference_manual/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,11 @@ timer(Pid) ->
end.
```

For more information on timers in Erlang in general, see the
[*Timers*](`e:erts:time_correction.md#timers`) section of the
[*Time and Time Correction in Erlang*](`e:erts:time_correction.md`)
ERTS User's guide.

## Term Comparisons

```
Expand Down

0 comments on commit a6bc894

Please sign in to comment.