Android: use getprop persist.sys.timezone to get and set the time zone

Untested. Maybe
fixes #1351
This commit is contained in:
Frank Denis 2020-06-06 15:30:32 +02:00
parent 9d1eee4b29
commit b0e883ebc6
3 changed files with 28 additions and 0 deletions

View File

@ -27,6 +27,7 @@ type App struct {
}
func main() {
TimezoneSetup()
dlog.Init("dnscrypt-proxy", dlog.SeverityNotice, "DAEMON")
seed := make([]byte, 8)

View File

@ -0,0 +1,20 @@
package main
import (
"os/exec"
"strings"
"time"
)
func TimezoneSetup() error {
out, err := exec.Command("/system/bin/getprop", "persist.sys.timezone").Output()
if err != nil {
return err
}
z, err := time.LoadLocation(strings.TrimSpace(string(out)))
if err != nil {
return err
}
time.Local = z
return nil
}

View File

@ -0,0 +1,7 @@
// +build !android
package main
func TimezoneSetup() error {
return nil
}