| diff --git a/Cargo.toml b/Cargo.toml |
| index 9f0f82f..535a845 100644 |
| --- a/Cargo.toml |
| +++ b/Cargo.toml |
| @@ -88,8 +88,6 @@ __internal_bench = [] |
| alloc = [] |
| clock = [ |
| "winapi", |
| - "iana-time-zone", |
| - "android-tzdata", |
| "now", |
| ] |
| default = [ |
| diff --git a/patches/no-tzdata.patch b/patches/no-tzdata.patch |
| index 230cf9e..e69de29 100644 |
| --- a/patches/no-tzdata.patch |
| +++ b/patches/no-tzdata.patch |
| @@ -1,13 +0,0 @@ |
| -diff --git a/Cargo.toml b/Cargo.toml |
| -index 9f0f82f..535a845 100644 |
| ---- a/Cargo.toml |
| -+++ b/Cargo.toml |
| -@@ -88,8 +88,6 @@ __internal_bench = [] |
| - alloc = [] |
| - clock = [ |
| - "winapi", |
| -- "iana-time-zone", |
| -- "android-tzdata", |
| - "now", |
| - ] |
| - default = [ |
| diff --git a/src/offset/local/unix.rs b/src/offset/local/unix.rs |
| index ce96a6e..ce844cc 100644 |
| --- a/src/offset/local/unix.rs |
| +++ b/src/offset/local/unix.rs |
| @@ -77,8 +77,14 @@ const TZDB_LOCATION: &str = "/usr/share/lib/zoneinfo"; |
| #[cfg(not(any(target_os = "android", target_os = "aix")))] |
| const TZDB_LOCATION: &str = "/usr/share/zoneinfo"; |
| |
| +// Android patch to avoid iana-time-zone dependency. |
| +fn get_timezone() -> Result<String, std::io::Error> { |
| + let tz_name = std::fs::read_to_string("/etc/timezone")?; |
| + Ok(tz_name.trim_end().to_string()) |
| +} |
| + |
| fn fallback_timezone() -> Option<TimeZone> { |
| - let tz_name = iana_time_zone::get_timezone().ok()?; |
| + let tz_name = get_timezone().ok()?; |
| #[cfg(not(target_os = "android"))] |
| let bytes = fs::read(format!("{}/{}", TZDB_LOCATION, tz_name)).ok()?; |
| #[cfg(target_os = "android")] |