1
0
mirror of https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks.git synced 2025-09-09 15:40:45 +02:00

timezone selector fix (#909)

* Added time zone selection in web config based on time zone name.

* Added default timezone config file. Default is Abidjan because first in list that is GMT0, which probably matches the default in `/etc/TZ`

* Update timezone.conf

* Added default timezone config file. Default is Abidjan because first in list that is GMT0, which probably matches the default in `/etc/TZ`

* improved time zone changes with seperate function. timezone is now set at boot time to avoid time zone name and actual system time zone mismatch
This commit is contained in:
Jelmer Tiete
2019-02-02 12:29:27 -05:00
committed by jmtatsch
parent 64b5202e92
commit f1047c7f5e
4 changed files with 18 additions and 15 deletions

View File

@@ -196,20 +196,11 @@ if [ -n "$F_cmd" ]; then
timezone_name=$(printf '%b' "${F_timeZone//%/\\x}")
if [ "$(cat /system/sdcard/config/timezone.conf)" != "$timezone_name" ]; then
echo "<p>Setting time zone name to '$timezone_name'...</p>"
echo "<p>Setting time zone to '$timezone_name'...</p>"
echo "$timezone_name" > /system/sdcard/config/timezone.conf
fi
timezone=$(/system/sdcard/bin/busybox awk -F '\t' -v tzn="$timezone_name" '($1==tzn) {print $2}' /system/sdcard/www/timezones.tsv)
if [ "$(cat /etc/TZ)" != "$timezone" ]; then
echo "<p>Setting TZ to '$timezone'...</p>"
echo "$timezone" > /etc/TZ
echo "<p>Syncing time...</p>"
if /system/sdcard/bin/busybox ntpd -q -n -p "$ntp_srv" > /dev/null 2>&1; then
echo "<p>Success</p>"
else echo "<p>Failed</p>"
fi
fi
# Set system timezone from timezone name
set_timezone
fi
hst=$(printf '%b' "${F_hostname//%/\\x}")
if [ "$(cat /system/sdcard/config/hostname.conf)" != "$hst" ]; then