tzdb — Time Zone Database
Static time zone information for tz-rs.
This crate provides all time zones found in the Time Zone Database, currently in the version 2022b (released 2022-08-10).
See the documentation for a full list the the contained time zones: https://docs.rs/tzdb/latest/tzdb/time_zone/index.html
Usage examples
let time_zone = local_tz?; // tz::TimeZoneRef<'_>
let current_time = local?; // tz::DateTime
// access by identifier
let time_zone = KYIV;
let current_time = in_tz?;
// access by name
let time_zone = tz_by_name?;
let current_time = in_named?;
// names are case insensitive
let time_zone = tz_by_name?;
let current_time = in_named?;
// provide a default time zone
let current_time = local_or?;
let current_time = in_named_or?;
Feature flags
-
by-name(enabled by default, enabled bylocal) — enablestz_by_name()to get a time zone at runtime by name -
list(enabled by default) — enablesTZ_NAMESto get a list of all shipped time zones -
local(enabled by default) — enableslocal_tz()to get the system time zone -
now(enabled by default) — enables the modulenowto get the current time -
binary– make the unparsed, binary tzdata of a time zone available -
std(enabled by default) – enable features that need the standard librarystd -
alloc(enabled by default, enabled bystd) – enable features that need the standard libraryalloc -
fallback(enabled by default) — compile for unknown target platforms, too
Git cloning
The main branch gets squashed regularily to keep the size of the repository at a maintainable size.
To get the history until then, please refer to the id in the initial commit.