It is also the case for Process.send_after, it returns a ref. And it is possible to read the elapsed time with Process.read_timer(ref), or cancel timer. I also store the ref in the server state.
Both are doing the same, but not the same way. I don’t use :timer module because it can get overloaded.
From Common Caveats — Erlang System Documentation v29.0.2
Creating timers using erlang:send_after/3 and erlang:start_timer/3, is much more efficient than using the timers provided by the timer module in STDLIB.






















