diff --git a/dnscrypt-proxy/main.go b/dnscrypt-proxy/main.go index 54003b99..2dd3d09a 100644 --- a/dnscrypt-proxy/main.go +++ b/dnscrypt-proxy/main.go @@ -27,6 +27,7 @@ type App struct { } func main() { + TimezoneSetup() dlog.Init("dnscrypt-proxy", dlog.SeverityNotice, "DAEMON") seed := make([]byte, 8) diff --git a/dnscrypt-proxy/timezone_android.go b/dnscrypt-proxy/timezone_android.go new file mode 100644 index 00000000..eb7015c0 --- /dev/null +++ b/dnscrypt-proxy/timezone_android.go @@ -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 +} diff --git a/dnscrypt-proxy/timezone_others.go b/dnscrypt-proxy/timezone_others.go new file mode 100644 index 00000000..e069c42e --- /dev/null +++ b/dnscrypt-proxy/timezone_others.go @@ -0,0 +1,7 @@ +// +build !android + +package main + +func TimezoneSetup() error { + return nil +}