Android: use getprop persist.sys.timezone to get and set the time zone
Untested. Maybe fixes #1351
This commit is contained in:
parent
9d1eee4b29
commit
b0e883ebc6
|
@ -27,6 +27,7 @@ type App struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
TimezoneSetup()
|
||||||
dlog.Init("dnscrypt-proxy", dlog.SeverityNotice, "DAEMON")
|
dlog.Init("dnscrypt-proxy", dlog.SeverityNotice, "DAEMON")
|
||||||
|
|
||||||
seed := make([]byte, 8)
|
seed := make([]byte, 8)
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
// +build !android
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
func TimezoneSetup() error {
|
||||||
|
return nil
|
||||||
|
}
|
Loading…
Reference in New Issue