Rand Stats

Timezones::ZoneInfo

zef:guifa

Timezones::ZoneInfo

A Raku module containing data (as well as some support routines) based on IANA's TZ database. This module is not normally expected to be consumed on its own — it is designed to be as light weight as possible. Its intended use is for authors of various time-related tools.

Current IANA database version: 2022e

Usage

The first four subs are exported by default. All methods work on times with integral seconds. It is currently left to the end user to handle any fractional seconds.

The final two methods are available by providing the tz-shift option in the use statement. They will return a time in the same format provided.

Both next-tz-shift and prev-tz-shift can potentially return a special extremely small or large integer value.
Such values are intended to represent an “infinite” past or future, but may be different given compiler/architecture/system. Timezones::ZoneInfo will detect your system's maximum and minimum time values upon installation and those values can be obtained using the constants max-posix-time and min-posix-time (exported with :constants in the use statement). On my system, for instance, these are 263 - 1 - 27, and 0 - 263, where 27 is the current number of leapseconds.

Class reference

Timezones::ZoneInfo::Time

A Raku version of the POSIX tm struct (with BSD/GNU extension). Attributes include

The infinite ranged elements aren't actually that as they're stored as int32.

Timezones::ZoneInfo::State

A Raku version of tz's state struct. It will be made more easily introspectable in the future. For now, these are the attributes:

Data

The data comes from IANA's tz database.

Todo

Version history

Copyright and license

The tz database and the code in it is public domain. Therefore, the author of this module (Matthew Stephen Stuckwisch) would find it unconscionable to release this module under any license, even for his own additions. Consequently, this module is similarly expressly released into the public domain. For jurisdictions where that is not possible, this module may be considered © 2021–2022 and licensed under CC0 v1.0 (see accompanying license file).