#timezone #timestamp #IANA #tzfiles #TZIF

libtzfile

This low-level library reads the system timezone information files (TZIF) provided by IANA and returns a struct representing the TZfile fields as described in the man page (http://man7.org/linux/man-pages/man5/tzfile.5.html)

15 releases (stable)

new 1.1.2 Aug 4, 2020
1.1.1 Jul 29, 2020
1.1.0 Jun 26, 2020
1.0.6 Jan 23, 2020
0.3.0 Nov 20, 2019

#51 in Date and time

Download history 11/week @ 2020-04-18 19/week @ 2020-04-25 3/week @ 2020-05-02 2/week @ 2020-05-09 4/week @ 2020-05-16 15/week @ 2020-05-23 30/week @ 2020-05-30 19/week @ 2020-06-06 3/week @ 2020-06-13 14/week @ 2020-06-20 27/week @ 2020-06-27 19/week @ 2020-07-04 27/week @ 2020-07-11 16/week @ 2020-07-18 20/week @ 2020-07-25 22/week @ 2020-08-01

69 downloads per month
Used in 2 crates (via tzparse)

GPL-3.0 license

17KB
224 lines

libtzfile

Current Crates.io Version Downloads badge

This library reads the system timezone information files provided by IANA and returns a Tz struct representing the TZfile fields as described in the man page (http://man7.org/linux/man-pages/man5/tzfile.5.html).

For higher level parsing, see my high-level parsing library.

Here is an example:

fn main() {
    println!("{:?}", libtzfile::parse("/usr/share/zoneinfo/America/Phoenix").unwrap());
}
Tz { tzh_timecnt_data: [-2717643600, -1633273200, -1615132800, -1601823600, -1583683200, -880210800, -820519140, -812653140, -796845540, -84380400, -68659200],
tzh_timecnt_indices: [2, 1, 2, 1, 2, 3, 2, 3, 2, 1, 2], tzh_typecnt: [Ttinfo { tt_gmtoff: -26898, tt_isdst: 0, tt_abbrind: 0 },
Ttinfo { tt_gmtoff: -21600, tt_isdst: 1, tt_abbrind: 1 }, Ttinfo { tt_gmtoff: -25200, tt_isdst: 0, tt_abbrind: 2 },
Ttinfo { tt_gmtoff: -21600, tt_isdst: 1, tt_abbrind: 3 }], tz_abbr: ["LMT", "MDT", "MST", "MWT"] }

The tests (cargo test) are written to match 2020a version of timezone database.

License: GPL-3.0

Dependencies

~110KB