SNTP v0.1.0 SNTP View Source
Documentation for SNTP.
Link to this section Summary
Functions
A convenience method there returns the system time
returns {:ok, timestamp} or {:error, reason}
returns timestamp or an error message
Link to this section Functions
A convenience method there returns the system time
Examples
iex> SNTP.now() <= System.system_time(1000)
(true || false)
Link to this function
offset(options \\ %{host: 'pool.ntp.org', port: 123, resolve_reference: false, timeout: :infinity})
View Source
Link to this function
time(options \\ %{host: 'pool.ntp.org', port: 123, resolve_reference: false, timeout: :infinity})
View Source
returns {:ok, timestamp} or {:error, reason}
Examples
iex> case SNTP.time() do {:ok, timestamp} -> :ok; {:error, reason} -> :error end
(:ok || :error)
Link to this function
time!(options \\ %{host: 'pool.ntp.org', port: 123, resolve_reference: false, timeout: :infinity})
View Source
returns timestamp or an error message
Examples
iex> case Kernel.is_map(SNTP.time!()) do true -> :ok; false -> :error end
(:ok || :error)