Implementation of the TagTime universal ping schedule in Elixir.
t = System.system_time(:second)
# Initialize RNG state and last ping, which we will need for the next ping
{state, ping_before_t} = Tagtime.init(t)
# next_ping/2 with these params now returns the first ping >= t in unix time
{state, ping} = Tagtime.next_ping(state, ping_before_t)
Add tagtime
to your list of dependencies in mix.exs
:
def deps do
[
{:tagtime, "~> 0.1.0"}
]
end
The docs can be found at https://hexdocs.pm/tagtime.