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