mirror of
https://github.com/chronotope/chrono.git
synced 2025-10-02 15:26:12 +00:00
set fallback feature in iana-time-zone depedency
This commit is contained in:
parent
511d368990
commit
84f98e01c7
@ -40,13 +40,12 @@ serde = { version = "1.0.99", default-features = false, optional = true }
|
||||
pure-rust-locales = { version = "0.5.2", optional = true }
|
||||
criterion = { version = "0.3", optional = true }
|
||||
rkyv = {version = "0.7", optional = true}
|
||||
iana-time-zone = { version = "0.1.41", optional = true, features = ["fallback"] }
|
||||
|
||||
[target.'cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))'.dependencies]
|
||||
wasm-bindgen = { version = "0.2", optional = true }
|
||||
js-sys = { version = "0.3", optional = true } # contains FFI bindings for the JS Date API
|
||||
|
||||
[target.'cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "solaris", target_env = "sgx")))'.dependencies]
|
||||
iana-time-zone = { version = "0.1.41", optional = true }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winapi = { version = "0.3.0", features = ["std", "minwinbase", "minwindef", "timezoneapi"], optional = true }
|
||||
|
@ -103,12 +103,6 @@ const TZDB_LOCATION: &str = " /system/usr/share/zoneinfo";
|
||||
#[cfg(not(target_os = "android"))]
|
||||
const TZDB_LOCATION: &str = "/usr/share/zoneinfo";
|
||||
|
||||
#[cfg(any(target_os = "emscripten", target_os = "wasi", target_os = "solaris"))]
|
||||
fn fallback_timezone() -> Option<TimeZone> {
|
||||
Some(TimeZone::utc())
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "solaris")))]
|
||||
fn fallback_timezone() -> Option<TimeZone> {
|
||||
let tz_name = iana_time_zone::get_timezone().ok()?;
|
||||
let bytes = fs::read(format!("{}/{}", TZDB_LOCATION, tz_name)).ok()?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user