[][src]Crate tzparse

PLEASE NOTE This library is no longer maintained and has been merged with the libtzfile library.

This library's functions are used to retrieve transition times and date/time characteristics for a given TZ. Based on IANA database, system timezone files and libtzfile library that you should use instead.

There are two functions:

get_zoneinfo parses the tzfile and returns a Tzinfo struct which provides useful and human-readable data about the timezone and can be converted to a json string with an optional feature.

get_timechanges obtains time changes for specified year, or all time changes recorded in the TZfile if no year is specified.

Example with get_zoneinfo:

tzparse = { version = "1.1", features=["json"] }
fn main() {
    println!("{}", tzparse::get_zoneinfo("/usr/share/zoneinfo/Europe/Paris").unwrap().to_json().unwrap());



The get_timechanges function for Europe/Paris in 2019 returns:

[Timechange { time: 2019-03-31T01:00:00Z, gmtoff: 7200, isdst: true, abbreviation: "CEST" },
Timechange { time: 2019-10-27T01:00:00Z, gmtoff: 3600, isdst: false, abbreviation: "CET" }]



The Timechange struct contains one timechange from the parsed TZfile.






Returns year's timechanges for a timezone. If year is Some(0), returns current year's timechanges. If there's no timechange for selected year, returns the last occured timechange to see selected zone's applying parameters. If no year (None) is specified, returns all time changes recorded in the TZfile .


Returns convenient data about a timezone for current date and time.