TimeZoneInfo v0.4.0 TimeZoneInfo View Source

TimeZoneInfo provides a time zone database for Elixir using the data from the the Internet Assigned Numbers Authority (IANA).

Therefore TimeZoneInfo contains an implementation of the Calendar.TimeZoneDatabase behaviour under TimeZoneInfo.TimeZoneDatabase.

Link to this section Summary

Types

The configuration for data generation

The data structure containing all informations for TimeZoneInfo.

A rule representation.

The name of a rule set that can be found in the IANA data.

A reference to a rule set. The reference also contains utc_offset and format, The reference contains utc_offset and format because these values are needed to apply a rule.

The time standards used by IANA.

A period where a certain combination of UTC offset, standard offset and zone abbreviation is in effect.

A transition marks a point in time when one or more of the values utc-offset, std_offset or zone-abbr change.

The zone_state is either a timezone_period or a rules_ref.

Functions

Generates TimeZoneInfo.data from the given iana_data_archive.

Returns the version of the IANA database.

Returns infos about persisted and stored data.

Returns the date time in UTC for the next update. Retruns :never if the automated update disabled.

Returns the state of TimeZoneInfo.

Returns the list of all available time zones with or without links. The option :links can be used to customize the list.

Triggers the update process. Withe the opt :force the update will be forced.

Link to this section Types

Link to this type

config()

View Source
config() :: [
  files: [String.t()],
  time_zones: [Calendar.time_zone()],
  lookahead: non_neg_integer()
]

The configuration for data generation

Link to this type

data()

View Source
data() :: %{
  version: String.t(),
  time_zones: %{required(Calendar.time_zone()) => [transition()]},
  rules: %{required(rule_name()) => [rule()]},
  links: %{required(Calendar.time_zone()) => Calendar.time_zone()}
}

The data structure containing all informations for TimeZoneInfo.

Link to this type

rule()

View Source
rule() ::
  {{Calendar.month(), TimeZoneInfo.IanaParser.day(),
    {Calendar.hour(), Calendar.minute(), Calendar.second()}}, time_standard(),
   Calendar.std_offset(), TimeZoneInfo.Transformer.Abbr.letters()}

A rule representation.

Link to this type

rule_name()

View Source
rule_name() :: String.t()

The name of a rule set that can be found in the IANA data.

Link to this type

rules_ref()

View Source
rules_ref() ::
  {Calendar.utc_offset(), rule_name(), TimeZoneInfo.Transformer.Abbr.format()}

A reference to a rule set. The reference also contains utc_offset and format, The reference contains utc_offset and format because these values are needed to apply a rule.

Link to this type

time_standard()

View Source
time_standard() :: :wall | :standard | :gmt | :utc | :zulu

The time standards used by IANA.

A period where a certain combination of UTC offset, standard offset and zone abbreviation is in effect.

This is equivalent to Calendar.TimeZoneDatabase.time_zone_period.t().

Link to this type

transition()

View Source
transition() ::
  {TimeZoneInfo.GregorianSeconds.t() | NaiveDateTime.t(), zone_state()}

A transition marks a point in time when one or more of the values utc-offset, std_offset or zone-abbr change.

The zone_state is either a timezone_period or a rules_ref.

Link to this section Functions

Link to this function

data(iana_data_archive, config \\ [])

View Source
data(binary(), config()) ::
  {:ok, binary() | data(), String.t()} | {:error, term()}

Generates TimeZoneInfo.data from the given iana_data_archive.

Link to this function

iana_version()

View Source
iana_version() :: String.t()

Returns the version of the IANA database.

Returns infos about persisted and stored data.

Link to this function

next_update()

View Source
next_update() :: DateTime.t() | :never | :error

Returns the date time in UTC for the next update. Retruns :never if the automated update disabled.

Link to this function

state()

View Source
state() :: :ok | {:next, non_neg_integer()} | {:error, term()}

Returns the state of TimeZoneInfo.

Returns

  • :ok if everything runs normal and the automated update is disabled.
  • {:next, seconds} if everything runs normal.
  • {:error, reason} in case of an error.
Link to this function

time_zones(opts \\ [links: :include])

View Source
time_zones([{:links, :ignore | :only | :include}]) :: [Calendar.time_zone()]

Returns the list of all available time zones with or without links. The option :links can be used to customize the list.

Values for :links:

  • :ignore just the time zone names will be returned
  • :only just the link names will be returned
  • :include the time zone and link names will be returned (default)

The list will be sorted.

Link to this function

update(opt \\ :run)

View Source
update(opt :: :run | :force) ::
  :ok | {:next, non_neg_integer()} | {:error, term()}

Triggers the update process. Withe the opt :force the update will be forced.