Tiny time helpers for the v1 / v2 endpoints that take unix-millisecond
timestamps (UnifiApi.Protect.Events.list/2 :start / :end,
UnifiApi.Network.Traffic.by_client/3 :start / :end, etc.).
Saves the boilerplate System.os_time(:millisecond) - 60 * 60 * 1000
that every time-window query ends up needing.
Examples
import UnifiApi.Time
# Last hour of motion events
{:ok, events} =
UnifiApi.Protect.Events.list(authed,
start: hours_ago(1),
end: now_ms(),
types: ["motion"]
)
Summary
Functions
Unix milliseconds for n days ago.
Unix milliseconds for n hours ago.
Unix milliseconds for n minutes ago. Accepts integers or floats.
Current time in unix milliseconds.
Functions
Unix milliseconds for n days ago.
Unix milliseconds for n hours ago.
Unix milliseconds for n minutes ago. Accepts integers or floats.
@spec now_ms() :: integer()
Current time in unix milliseconds.