Hello,
TimeZoneInfo is just another TimeZoneDatabase
.
Motivation: Before Tz was released my motivation was to fix some things in Tzdata. So TimeZoneInfo
includes all fixes that are also in Tz
and mentioned in this post. After Tz
was released I keep on coding because I have some different approaches and I wanted to play with :persistent_term
, :ets
, NimbleParsec
, and ETF (Erlang Term Format).
The most differences to the other both libraries are mentioned in the last section, but here are some details.
Some benchmarks to compare TimeZoneInfo
, Tz
, and Tzdata
.
TimeZoneInfo
uses NimbleParsec
to parse the IANA data. The parsed data is related to the pure IANA data, which means it should be easy to write this data back to a valid IANA file. After that, this data will be transformed into a TimeZoneInfo.data
format.
The data will be persisted in the priv
dir in a zipped ETF format. If you want to save the data in another way you can configure this as you need.
At runtime, the data can be stored in two different ways. Either with :persistent_term
(OTP >
21.2) or with :ets
. That can be also configured as data_store: :detect
(default), in this case TimeZoneInfo
will select :persistent_term
if it is available.
An automatic update is supported but is disabled by default. The downloader for the update is configurable and custom downloader can be used. It is also possible to download directly TimeZoneInfo.data
in a zipped ETF file.
Furthermore, you can configure which time zones should be used and how many years should be calculated in advance.
For time zones with continuation rules transitions in the future will be calculated on the fly if the periods-table does not contain enough info for those date times.
Thanks for your attention.
Comments, critic, reviews, issues and PRs are welcome!