Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: "27.1.2"
gleam-version: "1.12.0"
otp-version: "29"
gleam-version: "1.18.0"
rebar3-version: "3"
# elixir-version: "1"
- run: gleam deps download
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## v1.1.3 - 2026-08-08
- Add references to the zones gleam package with portable timezone data.
- Update documentation.

## v1.1.2 - 2025-11-01
- Fix issue with documentation.

## v1.1.1 - 2025-09-29
- Fix issue with leap second tables being recorded in unix leap time
rather than unix time.
Expand Down
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ gleam add tzif@1
# Using the Package
There are three modules in the `tzif` package:
- `tzif/database` has utilities for loading the IANA Time Zone database.
- `tzif/tzcalendar` has utilities for converting a [gleam_time](https://hexdocs.pm/gleam_time/)
- `tzif/tzcalendar` has utilities for converting a [gleam_time](https://gleam-time.hexdocs.pm/)
timestamp into date and time of day in a time zone.
- `tzif/parser` has functions and records for parsing TZif formatted data.

The most straightforward use would be to load the database from the default
location on the operating system, and then obtain a timestamp using the
[gleam_time](https://hexdocs.pm/gleam_time/) package, and convert that timestamp
[gleam_time](https://gleam-time.hexdocs.pm/) package, and convert that timestamp
into a time of day in a time zone using the IANA time zone name. An example
of that is shown in the code below.

Expand Down Expand Up @@ -83,6 +83,12 @@ package manager for your operating system to keep the time zone database up to
date. All common unix variants have time zone database packages and install the
time zone database files into the `/usr/share/zoneinfo` directory by default.

If, however, your system does not have time zone data installed, you can use
the [zones](https://zones.hexdocs.pm/) package to install a database of
timezone data as a gleam library and dependency. To use the zones timezone
data get the database using the `zones.database` function rather than
`database.load_from_os` or `database.load_from_path`.

## MacOS
The files should be included in your operating system by default. Check the
`/usr/share/zoneinfo` directory and see if they are present.
Expand Down Expand Up @@ -148,7 +154,6 @@ Similarly, using DNF:
sudo dnf install tzdata
```
## Windows
Microsoft Windows has a different mechanism for handling time zones, however
you can install the IANA Time Zone Database by [downloading the latest
version](https://www.iana.org/time-zones) and compiling the zone files using
[the directions in the repository](https://data.iana.org/time-zones/tz-link.html).
Microsoft Windows has a different mechanism for handling time zones, so we
recommend using the [zones](https://zones.hexdocs.pm/) portable gleam timezone
data library.
12 changes: 7 additions & 5 deletions gleam.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
name = "tzif"
version = "1.1.2"
version = "1.1.3"

# Fill out these fields if you intend to generate HTML documentation or publish
# your project to the Hex package manager.
#
description = "Time Zone Information File Utilities"
licences = ["MIT"]
repository = { type = "github", user = "devries", repo = "timezone" }
# links = [{ title = "Website", href = "" }]
#
# For a full reference of all the available options, you can have a look at
# https://gleam.run/writing-gleam/gleam-toml/.

[documentation]
pages = [
{ title = "Changelog", path = "changelog.html", source = "./CHANGELOG.md" },
{ title = "Examples", path = "examples.html", source = "./pages/examples.md"},
]

[dependencies]
gleam_stdlib = ">= 0.44.0 and < 2.0.0"
Expand Down
17 changes: 11 additions & 6 deletions manifest.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# This file was generated by Gleam
# You typically do not need to edit this file
# Do not manually edit this file, it is managed by Gleam.
#
# This file locks the dependency versions used, to make your build
# deterministic and to prevent unexpected versions from being included
# in your application.
#
# You should check this file into your source control repository.

packages = [
{ name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" },
{ name = "gleam_stdlib", version = "0.65.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "7C69C71D8C493AE11A5184828A77110EB05A7786EBF8B25B36A72F879C3EE107" },
{ name = "gleam_time", version = "1.5.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_time", source = "hex", outer_checksum = "D560E672C7279C89908981E068DF07FD16D0C859DCA266F908B18F04DF0EB8E6" },
{ name = "gleeunit", version = "1.7.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "CD701726CBCE5588B375D157B4391CFD0F2F134CD12D9B6998A395484DE05C58" },
{ name = "simplifile", version = "2.3.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "0A868DAC6063D9E983477981839810DC2E553285AB4588B87E3E9C96A7FB4CB4" },
{ name = "gleam_stdlib", version = "1.0.5", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "CEE5B6C076A85B45F60C585F4316C63EC8B7127C119D5738C3958A9C4D50404E" },
{ name = "gleam_time", version = "1.8.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_time", source = "hex", outer_checksum = "533D8723774D61AD4998324F5DD1DABDCDBFABAFB9E87CB5D03C6955448FC97D" },
{ name = "gleeunit", version = "1.11.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "EC31ABA74256AEA531EDF8169931D775BBB384FED0A8A1BDC4DD9354E3E21826" },
{ name = "simplifile", version = "2.7.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "A2727627B063E87351934C7F7F008F2D1FDB16F6DE0B8C79F9E46459CFC9C164" },
]

[requirements]
Expand Down
12 changes: 12 additions & 0 deletions pages/examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# tzif examples

Within the examples directory are some simple examples of how to use the tzif
library.

- [simple](https://github.com/devries/timezone/tree/reference-zones/examples/simple)
shows a program converting the current system time to the `America/New_York`
timezone and writing the result including the timezone designation.

- [time_now](https://github.com/devries/timezone/tree/reference-zones/examples/time_now)
will iterate through the available timezones and print the current time in each
timezone available in the system timezone database.
Loading