| 1 | # iana-time-zone - get the IANA time zone for the current system |
| 2 | |
| 3 | [](https://crates.io/crates/iana-time-zone) |
| 4 | [](https://docs.rs/iana-time-zone/) |
| 5 | [](https://crates.io/crates/iana-time-zone) |
| 6 | [](https://github.com/strawlab/iana-time-zone/actions?query=branch%3Amain) |
| 7 | |
| 8 | This small utility crate gets the IANA time zone for the current system. This is |
| 9 | also known as the [tz database], tzdata, the zoneinfo database, and the Olson |
| 10 | database. |
| 11 | |
| 12 | [tz database]: https://en.wikipedia.org/wiki/Tz_database |
| 13 | |
| 14 | Example: |
| 15 | |
| 16 | ```rust |
| 17 | // Get the current time zone as a string. |
| 18 | let tz_str = iana_time_zone::get_timezone()?; |
| 19 | println!("The current time zone is: {}", tz_str); |
| 20 | ``` |
| 21 | |
| 22 | You can test this is working on your platform with: |
| 23 | |
| 24 | ``` |
| 25 | cargo run --example get_timezone |
| 26 | ``` |
| 27 | |
| 28 | ## Minimum supported rust version policy |
| 29 | |
| 30 | This crate has a minimum supported rust version (MSRV) of 1.62.0 for [Tier 1] |
| 31 | platforms. |
| 32 | |
| 33 | [tier 1]: https://doc.rust-lang.org/1.62.0/rustc/platform-support.html |
| 34 | |
| 35 | Updates to the MSRV are sometimes necessary due to the MSRV of dependencies. |
| 36 | MSRV updates will not be indicated as a breaking change to the semver version. |
| 37 | |
| 38 | ## License |
| 39 | |
| 40 | Licensed under either of |
| 41 | |
| 42 | - Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or |
| 43 | <http://www.apache.org/licenses/LICENSE-2.0>) |
| 44 | - MIT license ([LICENSE-MIT](LICENSE-MIT) or |
| 45 | <http://opensource.org/licenses/MIT>) |
| 46 | |
| 47 | at your option. |
| 48 | |
| 49 | Unless you explicitly state otherwise, any contribution intentionally submitted |
| 50 | for inclusion in the work by you, as defined in the Apache-2.0 license, shall be |
| 51 | dual licensed as above, without any additional terms or conditions. |