### start_link(init_arg) Source: https://hexdocs.pm/nerves_time/NervesTime.Waiter.html Starts the NervesTime.Waiter process. ```APIDOC ## start_link(init_arg) ### Description Starts the NervesTime.Waiter process as part of a supervision tree. ### Signature `@spec start_link(keyword()) :: GenServer.on_start()` ``` -------------------------------- ### Start link specification for NervesTime.Waiter Source: https://hexdocs.pm/nerves_time/NervesTime.Waiter.html Defines the start_link function signature for the GenServer. ```elixir @spec start_link(keyword()) :: GenServer.on_start() ``` -------------------------------- ### child_spec(init_arg) Source: https://hexdocs.pm/nerves_time/NervesTime.Waiter.html Returns a specification to start the NervesTime.Waiter module under a supervisor. ```APIDOC ## child_spec(init_arg) ### Description Returns a specification to start this module under a supervisor. See `Supervisor` for more details. ``` -------------------------------- ### Get synchronization status Source: https://hexdocs.pm/nerves_time/NervesTime.html Returns the current NTP synchronization status. ```elixir @spec sync_status() :: sync_status() ``` -------------------------------- ### Get Time Zone Environment Variables Source: https://hexdocs.pm/nerves_time_zones/NervesTimeZones.html Returns environment variables required for time zone-aware OS processes. ```elixir @spec tz_environment() :: %{required(String.t()) => String.t()} ``` -------------------------------- ### Get Current Time Zone Source: https://hexdocs.pm/nerves_time_zones/NervesTimeZones.html Returns the currently configured local time zone as a string. ```elixir @spec get_time_zone() :: String.t() ``` -------------------------------- ### Implement init callback Source: https://hexdocs.pm/nerves_time/NervesTime.RealTimeClock.html Initializes the clock hardware. Must return {:ok, state()} for subsequent callbacks to be invoked. ```elixir @callback init(args :: any()) :: {:ok, state()} | {:error, reason :: any()} ``` -------------------------------- ### Configure startup initialization timeout Source: https://hexdocs.pm/nerves_time/index.html Set a timeout to block application startup until a valid system time is acquired. ```elixir # config/config.exs config :nerves_time, await_initialization_timeout: :timer.seconds(5) ``` -------------------------------- ### Configure vm.args for timewarps Source: https://hexdocs.pm/nerves_time/index.html Ensure Erlang's system time does not lag by enabling multi_time_warp in vm.args. ```text +C multi_time_warp ``` -------------------------------- ### Configure NTP servers Source: https://hexdocs.pm/nerves_time/index.html Specify custom NTP servers for time synchronization. ```elixir # config/config.exs config :nerves_time, :servers, [ "0.pool.ntp.org", "1.pool.ntp.org", "2.pool.ntp.org", "3.pool.ntp.org" ] ``` -------------------------------- ### Retrieve the time tracking file path Source: https://hexdocs.pm/nerves_time/NervesTime.FileTime.html Returns the path to the file used for tracking the system time. ```elixir @spec time_file() :: Path.t() ``` -------------------------------- ### Configure Abracon B5ZE with custom I2C settings Source: https://hexdocs.pm/nerves_time_rtc_abracon/NervesTime.RTC.Abracon.B5ZE.html Specify a custom I2C bus name and address if the default values are not applicable. ```elixir config :nerves_time, rtc: {NervesTime.RTC.Abracon.B5ZE, [bus_name: "i2c-2", address: 0x68]} ``` -------------------------------- ### ntp_servers/0 Source: https://hexdocs.pm/nerves_time/NervesTime.html Returns the list of currently configured NTP servers. ```APIDOC ## ntp_servers() ### Description Returns the current list of NTP servers configured for time synchronization. ### Returns - **list** - A list of NTP server addresses. ``` -------------------------------- ### decode(arg1) Source: https://hexdocs.pm/nerves_time_rtc_abracon/NervesTime.RTC.Abracon.B5ZE.Configuration.html Decodes a 24-bit binary configuration into a configuration map. ```APIDOC ## decode(arg1) ### Description Decodes a 24-bit binary representation into a configuration map (t()). ### Signature `decode(<<_::24>>) :: {:ok, t()} | {:error, any()}` ``` -------------------------------- ### Configure hardware RTC Source: https://hexdocs.pm/nerves_time/index.html Set a custom module to handle hardware real-time clock interactions. ```elixir config :nerves_time, rtc: {SomeImplementingModule, [some: :initialization_opt]} ``` -------------------------------- ### Configure AB0805 with Custom I2C Parameters Source: https://hexdocs.pm/nerves_time_rtc_abracon/NervesTime.RTC.Abracon.AB0805.html Specify a custom I2C bus name and address if the defaults are not applicable. ```elixir config :nerves_time, rtc: {NervesTime.RTC.Abracon.AB0805, [bus_name: "i2c-2", address: 0x69]} ``` -------------------------------- ### Run OS Commands with Time Zone Environment Source: https://hexdocs.pm/nerves_time_zones/index.html Executes system commands and synchronizes the C runtime environment with the BEAM time zone settings. ```elixir iex> System.cmd("date", []) {"Thu 11 Mar 2021 10:34:14 AM EST\n", 0} ``` ```elixir iex> NervesTimeZones.set_time_zone("Pacific/Honolulu") :ok ``` ```elixir iex> System.cmd("date", [], env: NervesTimeZones.tz_environment()) {"Thu 11 Mar 2021 05:40:38 AM HST\n", 0} iex)> NaiveDateTime.local_now ~N[2021-03-11 05:40:49] ``` -------------------------------- ### Retrieve Local Time Source: https://hexdocs.pm/nerves_time_zones/readme.html Shows the default UTC local time and how to update the system time zone using NervesTimeZones. ```elixir iex> DateTime.utc_now ~U[2021-03-11 15:10:41.573579Z] iex> NaiveDateTime.local_now ~N[2021-03-11 15:10:44] ``` ```elixir iex> NervesTimeZones.set_time_zone("America/New_York") :ok iex> NaiveDateTime.local_now ~N[2021-03-11 10:11:02] ``` -------------------------------- ### Configure RTC with custom I2C options Source: https://hexdocs.pm/nerves_time_rtc_abracon/readme.html Override the default I2C bus and address settings. ```elixir config :nerves_time, rtc: {NervesTime.RTC.Abracon.IBO5, [bus_name: "i2c-2", address: 0x69]} ``` -------------------------------- ### Add dependency to mix.exs Source: https://hexdocs.pm/nerves_time_rtc_abracon/index.html Include the library in your project's dependencies. ```elixir def deps do [ {:nerves_time_rtc_abracon, "~> 0.1.0"} ] end ``` -------------------------------- ### ntp_servers() Source: https://hexdocs.pm/nerves_time/NervesTime.html Retrieves the list of currently configured NTP servers. ```APIDOC ## ntp_servers() ### Description Returns the current list of NTP servers being used for time synchronization. ### Signature `ntp_servers() :: [String.t()] | {:error, term()}` ``` -------------------------------- ### Configure data directory Source: https://hexdocs.pm/nerves_time_zones/index.html Override the default persistence path for time zone data, useful for local development. ```elixir config :nerves_time_zones, data_dir: "./tmp/nerves_time_zones" ``` -------------------------------- ### Configure NTP servers Source: https://hexdocs.pm/nerves_time/NervesTime.html Sets the list of NTP servers to be queried. Can be configured via function call or application configuration. ```elixir @spec set_ntp_servers([String.t()]) :: :ok ``` ```elixir config :nerves_time, :servers, [ "0.pool.ntp.org", "1.pool.ntp.org", "2.pool.ntp.org", "3.pool.ntp.org" ] ``` ```elixir config :nerves_time, :servers, [] ``` -------------------------------- ### encode(cfg) Source: https://hexdocs.pm/nerves_time_rtc_abracon/NervesTime.RTC.Abracon.B5ZE.Configuration.html Encodes a configuration map into a 24-bit binary format. ```APIDOC ## encode(cfg) ### Description Encodes a configuration map (t()) into a 24-bit binary format. ### Signature `encode(t()) :: <<_::24>>` ``` -------------------------------- ### subscribe/1 Source: https://hexdocs.pm/nerves_time/NervesTime.html Subscribes a process to receive NTP daemon events. ```APIDOC ## subscribe(pid \\ self()) ### Description Subscribes the specified process to receive NTP daemon events. ### Parameters - **pid** (pid) - Optional - The process ID to subscribe. Defaults to the calling process. ``` -------------------------------- ### set_system_time/1 Source: https://hexdocs.pm/nerves_time/NervesTime.html Manually sets the system time. ```APIDOC ## set_system_time(time) ### Description Sets the system clock to the provided time. ### Parameters - **time** (term) - Required - The time value to set. ``` -------------------------------- ### Retrieve NTP servers Source: https://hexdocs.pm/nerves_time/NervesTime.html Returns the current list of configured NTP servers. ```elixir @spec ntp_servers() :: [String.t()] | {:error, term()} ``` -------------------------------- ### decode(arg1) Source: https://hexdocs.pm/nerves_time_rtc_abracon/NervesTime.RTC.Abracon.AB0805.Configuration.html Decodes a 16-bit binary representation into a configuration map. ```APIDOC ## decode(arg1) ### Description Decodes a 16-bit binary value into a configuration map (t()) representing the AB0805 RTC settings. ### Signature `decode(<<_::16>>) :: {:ok, t()} | {:error, any()}` ``` -------------------------------- ### set_ntp_servers(servers) Source: https://hexdocs.pm/nerves_time/NervesTime.html Updates the list of NTP servers used by the system. ```APIDOC ## set_ntp_servers(servers) ### Description Replaces the current list of NTP servers with the provided list of server addresses. ### Parameters - **servers** ([String.t()]) - Required - A list of NTP server hostnames or IP addresses. ### Signature `set_ntp_servers([String.t()]) :: :ok` ``` -------------------------------- ### Check Local Time Source: https://hexdocs.pm/nerves_time_zones/index.html Displays the default UTC local time behavior. ```elixir iex> DateTime.utc_now ~U[2021-03-11 15:10:41.573579Z] iex> NaiveDateTime.local_now ~N[2021-03-11 15:10:44] ``` -------------------------------- ### Configure NervesTime for Abracon B5ZE Source: https://hexdocs.pm/nerves_time_rtc_abracon/NervesTime.RTC.Abracon.B5ZE.html Set the RTC module in the application configuration to enable the Abracon B5ZE driver. ```elixir config :nerves_time, rtc: NervesTime.RTC.Abracon.B5ZE ``` -------------------------------- ### DateTime Database Error and Success Source: https://hexdocs.pm/nerves_time_zones/index.html Demonstrates the error returned without the dependency and the successful result after adding :nerves_time_zones. ```elixir iex> DateTime.now("America/New_York") {:error, :utc_only_time_zone_database} ``` ```elixir iex> DateTime.now("America/New_York") {:ok, #DateTime<2021-03-11 10:19:59.811175-05:00 EST America/New_York>} ``` -------------------------------- ### encode(cfg) Source: https://hexdocs.pm/nerves_time_rtc_abracon/NervesTime.RTC.Abracon.AB0805.Configuration.html Encodes a configuration map into a 16-bit binary representation. ```APIDOC ## encode(cfg) ### Description Encodes a configuration map (t()) into a 16-bit binary format suitable for the AB0805 RTC. ### Signature `encode(t()) :: <<_::16>>` ``` -------------------------------- ### Encode configuration Source: https://hexdocs.pm/nerves_time_rtc_abracon/NervesTime.RTC.Abracon.AB0805.Configuration.html Encodes a configuration map into a 16-bit binary. ```elixir @spec encode(t()) :: <<_::16>> ``` -------------------------------- ### Set system time Source: https://hexdocs.pm/nerves_time/NervesTime.html Sets the system time using a NaiveDateTime struct. ```elixir @spec set_system_time(NaiveDateTime.t()) :: :ok | :error ``` -------------------------------- ### Subscribe to NTP updates Source: https://hexdocs.pm/nerves_time/index.html Register a process to receive NTP daemon event notifications. ```elixir NervesTime.subscribe() ``` -------------------------------- ### Encode configuration Source: https://hexdocs.pm/nerves_time_rtc_abracon/NervesTime.RTC.Abracon.B5ZE.Configuration.html Encodes a configuration map into a 24-bit binary sequence. ```elixir @spec encode(t()) :: <<_::24>> ``` -------------------------------- ### set_time(path, naive_date_time) Source: https://hexdocs.pm/nerves_time/NervesTime.FileTime.html Updates the file holding a stamp of the current time. ```APIDOC ## set_time(path, naive_date_time) ### Description Update the file holding a stamp of the current time. ### Parameters - **path** (String) - Required - The path to the file used for tracking time. - **naive_date_time** (NaiveDateTime) - Required - The time to record. ``` -------------------------------- ### tz_environment() Source: https://hexdocs.pm/nerves_time_zones/NervesTimeZones.html Returns a map of environment variables required for time zone-aware OS processes. ```APIDOC ## tz_environment() ### Description Return environment variables for running OS processes. Use this when calling System.cmd/3 to ensure the process is time zone aware. ### Signature `tz_environment() :: %{required(String.t()) => String.t()}` ``` -------------------------------- ### Implement set_time callback Source: https://hexdocs.pm/nerves_time/NervesTime.RealTimeClock.html Updates the hardware clock with the provided time. Called periodically or when synchronization is required. ```elixir @callback set_time(state(), NaiveDateTime.t()) :: state() ``` -------------------------------- ### Add NervesTime dependency Source: https://hexdocs.pm/nerves_time/index.html Include the library in your project's dependencies within the mix file. ```elixir def deps do [ {:nerves_time, "~> 0.4.2"} ] end ``` -------------------------------- ### Decode configuration Source: https://hexdocs.pm/nerves_time_rtc_abracon/NervesTime.RTC.Abracon.B5ZE.Configuration.html Decodes a 24-bit binary sequence into a configuration map. ```elixir @spec decode(<<_::24>>) :: {:ok, t()} | {:error, any()} ``` -------------------------------- ### set_ntp_servers/1 Source: https://hexdocs.pm/nerves_time/NervesTime.html Updates the list of NTP servers used for synchronization. ```APIDOC ## set_ntp_servers(servers) ### Description Updates the list of NTP servers used by the system. ### Parameters - **servers** (list) - Required - A list of NTP server hostnames or IP addresses. ``` -------------------------------- ### Configure NervesTime for AB0805 Source: https://hexdocs.pm/nerves_time_rtc_abracon/NervesTime.RTC.Abracon.AB0805.html Set the RTC module in the application configuration. ```elixir config :nerves_time, rtc: NervesTime.RTC.Abracon.AB0805 ``` -------------------------------- ### Sync status snapshot structure Source: https://hexdocs.pm/nerves_time/index.html The data structure sent immediately upon subscription. ```elixir {:nerves_time, :sync_status, %{ synchronized?: boolean(), last_sync_report: %{ freq_drift_ppm: integer(), offset: float(), stratum: integer(), poll_interval: integer() } | nil, sync_acquired_at: DateTime.t() | nil, last_sync_at: DateTime.t() | nil }} ``` -------------------------------- ### Configure IANA database version Source: https://hexdocs.pm/nerves_time_zones/index.html Adjust the version of the IANA timezone database used by the library. ```elixir config :nerves_time_zones, version: "2025a" ``` -------------------------------- ### Decode configuration Source: https://hexdocs.pm/nerves_time_rtc_abracon/NervesTime.RTC.Abracon.AB0805.Configuration.html Decodes a 16-bit binary representation into a configuration map. ```elixir @spec decode(<<_::16>>) :: {:ok, t()} | {:error, any()} ``` -------------------------------- ### restart_ntpd/0 Source: https://hexdocs.pm/nerves_time/NervesTime.html Manually triggers a restart of the NTP daemon. ```APIDOC ## restart_ntpd() ### Description Manually restarts the NTP daemon process. ``` -------------------------------- ### Configure NervesTime for Abracon IBO5 Source: https://hexdocs.pm/nerves_time_rtc_abracon/NervesTime.RTC.Abracon.IBO5.html Set the RTC module in the application configuration. ```elixir config :nerves_time, rtc: NervesTime.RTC.Abracon.IBO5 ``` ```elixir config :nerves_time, rtc: {NervesTime.RTC.Abracon.IBO5, [bus_name: "i2c-2", address: 0x69]} ``` -------------------------------- ### Subscribe to NTP events Source: https://hexdocs.pm/nerves_time/NervesTime.html Subscribes a process to receive NTP daemon event messages. Subscribers receive an immediate sync_status message upon subscription. ```elixir @spec subscribe(pid()) :: :ok ``` ```elixir {:nerves_time, event, report} ``` -------------------------------- ### time_file() Source: https://hexdocs.pm/nerves_time/NervesTime.FileTime.html Returns the path to the file that keeps track of the time. ```APIDOC ## time_file() ### Description Return the path to the file that keeps track of the time. ### Signature `@spec time_file() :: Path.t()` ``` -------------------------------- ### List All Time Zones Source: https://hexdocs.pm/nerves_time_zones/NervesTimeZones.html Returns a list of all known time zones by scanning the database. ```elixir @spec time_zones() :: [String.t()] ``` -------------------------------- ### Define configuration struct Source: https://hexdocs.pm/nerves_time_rtc_abracon/NervesTime.RTC.Abracon.AB0805.Configuration.html Defines the configuration map structure for the AB0805 RTC. ```elixir @type t() :: %{ stop: bit(), twelve_hour: bit(), outb: bit(), out: bit(), arst: bit(), wrtc: bit(), out2s: 0..7, out1s: 0..3 } ``` -------------------------------- ### restart_ntpd() Source: https://hexdocs.pm/nerves_time/NervesTime.html Manually triggers a restart of the NTP daemon. ```APIDOC ## restart_ntpd() ### Description Manually restarts the NTP daemon. This is useful to force immediate time requests when network connectivity is established. ### Signature `restart_ntpd() :: :ok | {:error, term()}` ``` -------------------------------- ### Configure NervesTime for DS3231 Source: https://hexdocs.pm/nerves_time_rtc_ds3231/NervesTime.RTC.DS3231.html Update the :nerves_time application environment to use the DS3231 RTC module. ```elixir config :nerves_time, rtc: NervesTime.RTC.DS3231 ``` ```elixir config :nerves_time, rtc: {NervesTime.RTC.DS3231, [bus_name: "i2c-2", address: 0x69]} ``` -------------------------------- ### Implement terminate callback Source: https://hexdocs.pm/nerves_time/NervesTime.RealTimeClock.html Performs cleanup operations when the clock process terminates. ```elixir @callback terminate(state()) :: :ok ``` -------------------------------- ### Apache License 2.0 Text Source: https://hexdocs.pm/nerves_time_zones/index.html The legal license text for the NervesTimeZones project. ```text Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` -------------------------------- ### synchronized?/0 Source: https://hexdocs.pm/nerves_time/NervesTime.html Checks if the system is currently synchronized with NTP servers. ```APIDOC ## synchronized?() ### Description Returns a boolean indicating whether the system is currently synchronized with the configured NTP servers. ### Returns - **boolean** - True if synchronized, false otherwise. ``` -------------------------------- ### time_zones() Source: https://hexdocs.pm/nerves_time_zones/NervesTimeZones.html Returns a list of all known time zones available in the database. ```APIDOC ## time_zones() ### Description Return all known time zones. ### Signature `time_zones() :: [String.t()]` ``` -------------------------------- ### Configure NervesTime RTC Source: https://hexdocs.pm/nerves_time_rtc_abracon/index.html Set the RTC module type in your project configuration. ```elixir config :nerves_time, rtc: NervesTime.RTC.Abracon.IBO5 ``` ```elixir config :nerves_time, rtc: {NervesTime.RTC.Abracon.IBO5, [bus_name: "i2c-2", address: 0x69]} ``` -------------------------------- ### sync_status/0 Source: https://hexdocs.pm/nerves_time/NervesTime.html Returns the current NTP synchronization status. ```APIDOC ## sync_status() ### Description Returns the current synchronization status of the NTP daemon. ``` -------------------------------- ### Set Local Time Zone Source: https://hexdocs.pm/nerves_time_zones/index.html Updates the system time zone and verifies the shift in local time. ```elixir iex> NervesTimeZones.set_time_zone("America/New_York") :ok iex> NaiveDateTime.local_now ~N[2021-03-11 10:11:02] ``` -------------------------------- ### Restart NTP daemon Source: https://hexdocs.pm/nerves_time/NervesTime.html Manually restarts the NTP daemon. Use sparingly to avoid violating NTP Pool terms of service. ```elixir @spec restart_ntpd() :: :ok | {:error, term()} ``` -------------------------------- ### Configure time range Source: https://hexdocs.pm/nerves_time_zones/index.html Adjust the earliest and latest dates for which time zone information is maintained. ```elixir config :nerves_time_zones, earliest_date: DateTime.to_unix(~U[2022-05-17 12:02:32Z]), latest_date: System.os_time(:second) + 5 * 365 * 86400 ``` -------------------------------- ### Define configuration type Source: https://hexdocs.pm/nerves_time_rtc_abracon/NervesTime.RTC.Abracon.B5ZE.Configuration.html Defines the structure for the RTC configuration, including various flags and battery settings. ```elixir @type t() :: %{ stop: bit(), sr: bit(), twelve_hour: bit(), sie: bit(), aie: bit(), cie: bit(), wtaf: bit(), ctaf: bit(), ctbf: bit(), sf: bit(), af: bit(), wtaie: bit(), ctaie: bit(), ctbie: bit(), battery: 0..7, bsf: bit(), blf: bit(), bsei: bit(), blie: bit() } ``` -------------------------------- ### set_time_zone(time_zone) Source: https://hexdocs.pm/nerves_time_zones/NervesTimeZones.html Sets and persists the local time zone for the device. ```APIDOC ## set_time_zone(time_zone) ### Description Set the local time zone. Only known time zone names can be set; this setting is persisted across reboots. ### Parameters - **time_zone** (String.t) - Required - The IANA time zone name. ### Signature `set_time_zone(String.t()) :: :ok | {:error, any()}` ``` -------------------------------- ### Set Time Zone Source: https://hexdocs.pm/nerves_time_zones/NervesTimeZones.html Sets and persists the local time zone. Only valid IANA time zone names are accepted. ```elixir @spec set_time_zone(String.t()) :: :ok | {:error, any()} ``` -------------------------------- ### from_integer(value) Source: https://hexdocs.pm/nerves_time/NervesTime.RealTimeClock.BCD.html Converts an 8-bit integer value (0-99) to a BCD encoded value. ```APIDOC ## from_integer(value) ### Description Converts an 8-bit integer value to a BCD binary representation. ### Signature `from_integer(0..99) :: t()` ``` -------------------------------- ### Set default time zone Source: https://hexdocs.pm/nerves_time_zones/index.html Change the default time zone from the standard Etc/UTC. ```elixir config :nerves_time_zones, default_time_zone: "Europe/Paris" ``` -------------------------------- ### unsubscribe/1 Source: https://hexdocs.pm/nerves_time/NervesTime.html Unsubscribes a process from NTP daemon events. ```APIDOC ## unsubscribe(pid \\ self()) ### Description Unsubscribes the specified process from NTP daemon events. ### Parameters - **pid** (pid) - Optional - The process ID to unsubscribe. Defaults to the calling process. ``` -------------------------------- ### set_alarm(i2c, address, a1) Source: https://hexdocs.pm/nerves_time_rtc_ds3231/NervesTime.RTC.DS3231.html Writes an alarm register to the DS3231 RTC. ```APIDOC ## set_alarm(i2c, address, a1) ### Description Writes an alarm register to the DS3231 RTC. ### Parameters - **i2c** - The I2C bus identifier. - **address** - The I2C address of the RTC. - **a1** - The alarm value to write. ``` -------------------------------- ### terminate(path) Source: https://hexdocs.pm/nerves_time/NervesTime.FileTime.html Updates the timestamp one final time. ```APIDOC ## terminate(path) ### Description Update the timestamp one final time. ### Parameters - **path** (String) - Required - The path to the file used for tracking time. ``` -------------------------------- ### set_control(i2c, address, control) Source: https://hexdocs.pm/nerves_time_rtc_ds3231/NervesTime.RTC.DS3231.html Writes the control register to the DS3231 RTC. ```APIDOC ## set_control(i2c, address, control) ### Description Writes the control register to the DS3231 RTC. ### Parameters - **i2c** - The I2C bus identifier. - **address** - The I2C address of the RTC. - **control** - The control value to write. ``` -------------------------------- ### get_control(i2c, address) Source: https://hexdocs.pm/nerves_time_rtc_ds3231/NervesTime.RTC.DS3231.html Reads the control register from the DS3231 RTC. ```APIDOC ## get_control(i2c, address) ### Description Reads the control register from the DS3231 RTC. ### Parameters - **i2c** - The I2C bus identifier. - **address** - The I2C address of the RTC. ``` -------------------------------- ### Define sync_status type Source: https://hexdocs.pm/nerves_time/NervesTime.html Represents the current NTP synchronization state. ```elixir @type sync_status() :: %{ synchronized?: boolean(), last_sync_report: ntpd_event_report() | nil, sync_acquired_at: DateTime.t() | nil, last_sync_at: DateTime.t() | nil } ``` -------------------------------- ### get_time(path) Source: https://hexdocs.pm/nerves_time/NervesTime.FileTime.html Retrieves the timestamp of when the update was last called, or returns the Unix epoch time if the file read fails. ```APIDOC ## get_time(path) ### Description Return the timestamp of when update was last called or the Unix epoch time (1970-01-01) should that not work. ### Parameters - **path** (String) - Required - The path to the file used for tracking time. ``` -------------------------------- ### reset_time_zone() Source: https://hexdocs.pm/nerves_time_zones/NervesTimeZones.html Resets the system time zone to the default value (defaulting to 'Etc/UTC'). ```APIDOC ## reset_time_zone() ### Description Reset the time zone to the default. This cleans up any saved time zone information and reapplies the defaults. ### Signature `reset_time_zone() :: :ok` ``` -------------------------------- ### get_temperature(i2c, address) Source: https://hexdocs.pm/nerves_time_rtc_ds3231/NervesTime.RTC.DS3231.html Reads the temperature register from the DS3231 RTC. ```APIDOC ## get_temperature(i2c, address) ### Description Reads the temperature register from the DS3231 RTC. ### Parameters - **i2c** - The I2C bus identifier. - **address** - The I2C address of the RTC. ``` -------------------------------- ### Implement get_time callback Source: https://hexdocs.pm/nerves_time/NervesTime.RealTimeClock.html Retrieves the current time from the hardware clock. Returns :unset if the clock has not been initialized with a time. ```elixir @callback get_time(state()) :: {:ok, NaiveDateTime.t(), state()} | {:unset, state()} ``` -------------------------------- ### Configure valid time range Source: https://hexdocs.pm/nerves_time/index.html Override the default valid time range to prevent incorrect time values on systems without reliable clocks. ```elixir # config/config.exs config :nerves_time, earliest_time: ~N[2019-10-04 00:00:00], latest_time: ~N[2022-01-01 00:00:00] ``` -------------------------------- ### NTP event message format Source: https://hexdocs.pm/nerves_time/index.html The structure of messages received by subscribers. ```elixir {:nerves_time, event, payload} ``` -------------------------------- ### set_status(i2c, address, status) Source: https://hexdocs.pm/nerves_time_rtc_ds3231/NervesTime.RTC.DS3231.html Writes the status register to the DS3231 RTC. ```APIDOC ## set_status(i2c, address, status) ### Description Writes the status register to the DS3231 RTC. ### Parameters - **i2c** - The I2C bus identifier. - **address** - The I2C address of the RTC. - **status** - The status value to write. ``` -------------------------------- ### get_time_zone() Source: https://hexdocs.pm/nerves_time_zones/NervesTimeZones.html Returns the currently configured local time zone as a string. ```APIDOC ## get_time_zone() ### Description Returns the current local time zone. ### Signature `get_time_zone() :: String.t()` ``` -------------------------------- ### Convert integer to BCD Source: https://hexdocs.pm/nerves_time/NervesTime.RealTimeClock.BCD.html Converts an 8-bit integer value between 0 and 99 to its BCD binary representation. ```elixir @spec from_integer(0..99) :: t() ``` -------------------------------- ### to_integer(value) Source: https://hexdocs.pm/nerves_time/NervesTime.RealTimeClock.BCD.html Converts an 8-bit BCD-encoded value back to an integer. ```APIDOC ## to_integer(value) ### Description Converts an 8-bit BCD-encoded value to an integer. ### Signature `to_integer(t()) :: 0..99` ``` -------------------------------- ### Reset Time Zone Source: https://hexdocs.pm/nerves_time_zones/NervesTimeZones.html Resets the time zone to the default, which is 'Etc/UTC' unless overridden in configuration. ```elixir @spec reset_time_zone() :: :ok ``` ```elixir config :nerves_time_zones, default_time_zone: "Asia/Tokyo" ``` -------------------------------- ### Check synchronization state Source: https://hexdocs.pm/nerves_time/NervesTime.html Checks if NTP is synchronized with configured servers based on clock stratum. ```elixir @spec synchronized?() :: boolean() ``` -------------------------------- ### get_status(i2c, address) Source: https://hexdocs.pm/nerves_time_rtc_ds3231/NervesTime.RTC.DS3231.html Reads the status register from the DS3231 RTC. ```APIDOC ## get_status(i2c, address) ### Description Reads the status register from the DS3231 RTC. ### Parameters - **i2c** - The I2C bus identifier. - **address** - The I2C address of the RTC. ``` -------------------------------- ### get_alarm(i2c, address, alarm_num) Source: https://hexdocs.pm/nerves_time_rtc_ds3231/NervesTime.RTC.DS3231.html Reads an alarm register from the DS3231 RTC. ```APIDOC ## get_alarm(i2c, address, alarm_num) ### Description Reads an alarm register from the DS3231 RTC. ### Parameters - **i2c** - The I2C bus identifier. - **address** - The I2C address of the RTC. - **alarm_num** - The alarm number to read. ``` -------------------------------- ### Define ntpd_event type Source: https://hexdocs.pm/nerves_time/NervesTime.html Represents the NTP daemon event names emitted to subscribers. ```elixir @type ntpd_event() :: :sync_status | :sync_acquired | :sync_updated | :sync_lost | :clock_step ``` -------------------------------- ### Convert BCD to integer Source: https://hexdocs.pm/nerves_time/NervesTime.RealTimeClock.BCD.html Converts an 8-bit BCD-encoded value back to its integer representation. ```elixir @spec to_integer(t()) :: 0..99 ``` -------------------------------- ### valid_time_zone?(time_zone) Source: https://hexdocs.pm/nerves_time_zones/NervesTimeZones.html Checks if a given time zone string is valid. ```APIDOC ## valid_time_zone?(time_zone) ### Description Return whether a time zone is valid. ### Parameters - **time_zone** (String.t) - Required - The time zone name to validate. ### Signature `valid_time_zone?(String.t()) :: boolean()` ``` -------------------------------- ### Define ntpd_event_report type Source: https://hexdocs.pm/nerves_time/NervesTime.html Metadata reported by the NTP helper script for a synchronization event. ```elixir @type ntpd_event_report() :: %{ freq_drift_ppm: integer(), offset: float(), stratum: integer(), poll_interval: integer() } ``` -------------------------------- ### Define state type Source: https://hexdocs.pm/nerves_time_rtc_nxp/NervesTime.RTC.NXP.PCA8565.html Represents the internal state of the RTC driver, including the I2C bus reference and address. ```elixir @type state() :: %{ i2c: Circuits.I2C.Bus.t(), bus_name: String.t(), address: address() } ``` -------------------------------- ### Define state type Source: https://hexdocs.pm/nerves_time/NervesTime.RealTimeClock.html Defines the internal state type for the hardware clock implementation. ```elixir @type state() :: any() ``` -------------------------------- ### Define address type Source: https://hexdocs.pm/nerves_time_rtc_nxp/NervesTime.RTC.NXP.PCA8565.html Represents the I2C address as a positive integer. ```elixir @type address() :: pos_integer() ``` -------------------------------- ### Validate Time Zone Source: https://hexdocs.pm/nerves_time_zones/NervesTimeZones.html Checks if a given time zone name is valid. ```elixir @spec valid_time_zone?(String.t()) :: boolean() ``` -------------------------------- ### Define bit type Source: https://hexdocs.pm/nerves_time_rtc_abracon/NervesTime.RTC.Abracon.B5ZE.Configuration.html Represents a single bit value as either 0 or 1. ```elixir @type bit() :: 0 | 1 ``` -------------------------------- ### Unsubscribe from NTP events Source: https://hexdocs.pm/nerves_time/NervesTime.html Removes a process from receiving NTP daemon event notifications. ```elixir @spec unsubscribe(pid()) :: :ok ``` -------------------------------- ### Define flag type Source: https://hexdocs.pm/nerves_time_rtc_ds3231/NervesTime.RTC.DS3231.html Represents registers that hold a single bit value. ```elixir @type flag() :: 0 | 1 ``` -------------------------------- ### Define BCD type Source: https://hexdocs.pm/nerves_time/NervesTime.RealTimeClock.BCD.html Represents the valid range for two-digit packed BCD values. ```elixir @type t() :: 0..9 | 16..25 | 32..41 | 48..57 | 64..73 | 80..89 | 96..105 | 112..121 | 128..137 | 144..153 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.