GTimeZone does not work on Android
Submitted by Fredrik Fornwall
Link to original bug (#771304)
Description
The GTimeZone implementation in gtimezone.c uses /etc/localtime and /usr/share/zoneinfo, which does not exist on Android.
The current timezone can be obtained using __system_property_get() from <sys/system_properties.h>, as in: __system_property_get("persist.sys.timezone", timezone_value)
For timezone information, Android have all tzdata files compiled into a single file, /system/usr/share/zoneinfo/tzdata, using the https://android.googlesource.com/platform/external/icu/+/master/tools/ZoneCompactor.java tool where the file format is documented.
The fix is perhaps two steps in ifdef ANDROID:
(1) Use __system_property_get("persist.sys.timezone", timezone_value) instead of /etc/localtime if the TZ environment variable is not set.
(2) Use the /system/usr/share/zoneinfo/tzdata database file instead of files under /usr/share/zoneinfo.