ffi_utils.rs |
Cross platform FFI helpers. |
19934 |
lib.rs |
get the IANA time zone for the current system
This small utility crate provides the
[`get_timezone()`](fn.get_timezone.html) function.
```rust
// Get the current time zone as a string.
let tz_str = iana_time_zone::get_timezone()?;
println!("The current time zone is: {}", tz_str);
# Ok::<(), iana_time_zone::GetTimezoneError>(())
```
The resulting string can be parsed to a
[`chrono-tz::Tz`](https://docs.rs/chrono-tz/latest/chrono_tz/enum.Tz.html)
variant like this:
```rust
let tz_str = iana_time_zone::get_timezone()?;
let tz: chrono_tz::Tz = tz_str.parse()?;
# Ok::<(), Box<dyn std::error::Error>>(())
``` |
3481 |
platform.rs |
|
357 |
tz_aix.rs |
|
223 |
tz_android.rs |
|
936 |
tz_darwin.rs |
|
6711 |
tz_freebsd.rs |
|
348 |
tz_haiku.rs |
|
163 |
tz_illumos.rs |
|
799 |
tz_linux.rs |
|
6731 |
tz_netbsd.rs |
|
879 |
tz_ohos.rs |
OpenHarmony doesn't have `/etc/localtime`, we have to use it's "Time Service" to get the timezone information:
- [API Reference](https://gitee.com/openharmony/docs/blob/43726785b4033887cd1a838aaaca5e255897a71e/en/application-dev/reference/apis-basic-services-kit/_time_service.md#oh_timeservice_gettimezone) |
1875 |
tz_wasm32_unknown.rs |
|
602 |
tz_windows.rs |
|
587 |
windows_bindings.rs |
|
68141 |