mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 10:58:57 +00:00
lib/syncthing: Set system timezone on android (#7878)
This commit is contained in:
parent
952f3ffb0c
commit
db302b15ea
26
lib/syncthing/time_android.go
Normal file
26
lib/syncthing/time_android.go
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright (C) 2021 The Syncthing Authors.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
package syncthing
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// https://github.com/golang/go/issues/20455#issuecomment-342287698
|
||||
func init() {
|
||||
out, err := exec.Command("/system/bin/getprop", "persist.sys.timezone").Output()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
z, err := time.LoadLocation(strings.TrimSpace(string(out)))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
time.Local = z
|
||||
}
|
Loading…
Reference in New Issue
Block a user