Skip to content

Commit 31b3184

Browse files
set fallback feature in iana-time-zone depedency
2 parents 24715f0 + 6f9af6f commit 31b3184

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,12 @@ serde = { version = "1.0.99", default-features = false, optional = true }
4040
pure-rust-locales = { version = "0.5.2", optional = true }
4141
criterion = { version = "0.3", optional = true }
4242
rkyv = {version = "0.7", optional = true}
43+
iana-time-zone = { version = "0.1.41", optional = true, features = ["fallback"] }
4344

4445
[target.'cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))'.dependencies]
4546
wasm-bindgen = { version = "0.2" }
4647
js-sys = { version = "0.3" } # contains FFI bindings for the JS Date API
4748

48-
[target.'cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "solaris", target_env = "sgx")))'.dependencies]
49-
iana-time-zone = { version = "0.1.41", optional = true }
5049

5150
[target.'cfg(windows)'.dependencies]
5251
winapi = { version = "0.3.0", features = ["std", "minwinbase", "minwindef", "timezoneapi"], optional = true }

src/offset/local/unix.rs

-6
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,6 @@ const TZDB_LOCATION: &str = " /system/usr/share/zoneinfo";
103103
#[cfg(not(target_os = "android"))]
104104
const TZDB_LOCATION: &str = "/usr/share/zoneinfo";
105105

106-
#[cfg(any(target_os = "emscripten", target_os = "wasi", target_os = "solaris"))]
107-
fn fallback_timezone() -> Option<TimeZone> {
108-
Some(TimeZone::utc())
109-
}
110-
111-
#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "solaris")))]
112106
fn fallback_timezone() -> Option<TimeZone> {
113107
let tz_name = iana_time_zone::get_timezone().ok()?;
114108
let bytes = fs::read(format!("{}/{}", TZDB_LOCATION, tz_name)).ok()?;

0 commit comments

Comments
 (0)