Is it possible to get the value (the remaining time) of a gen_statem
state time-out ? Note that I could store the datetime when hitting the state enter call and thus know the time elapsed since it is in the given state.
Hello, welcome to the community!
No, it is unfortunately not possible to get the remaining time. That is even an example in the user’s guide gen_statem Behaviour — Erlang System Documentation v27.0 for when you have to use the regular Erlang timers…
1 Like
Then, again, it is also not possible to get the remaining time of an erlang timer without cancelling it…
But you could set the time-out to an absolute time and then check how far off that absolute time is, with a gen_statem
timer as well as an erlang timer.
1 Like