File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import (
1717 "github.com/mindoc-org/mindoc/commands"
1818 "github.com/mindoc-org/mindoc/commands/daemon"
1919 _ "github.com/mindoc-org/mindoc/routers"
20+ "github.com/mindoc-org/mindoc/utils"
2021)
2122
2223func isViaDaemonUnix () bool {
@@ -49,6 +50,11 @@ func main() {
4950
5051 d := daemon .NewDaemon ()
5152
53+ // 安卓 go/src/time/zoneinfo_android.go 固定localLoc 为 UTC
54+ if runtime .GOOS == "android" {
55+ utils .FixTimezone ()
56+ }
57+
5258 if runtime .GOOS != "windows" && ! isViaDaemonUnix () {
5359 s , err := service .New (d , d .Config ())
5460
Original file line number Diff line number Diff line change 1+ package utils
2+
3+ import (
4+ "os/exec"
5+ "strings"
6+ "time"
7+ )
8+
9+ func FixTimezone () {
10+ out , err := exec .Command ("/system/bin/getprop" , "persist.sys.timezone" ).Output ()
11+ if err != nil {
12+ return
13+ }
14+ timeZone , err := time .LoadLocation (strings .TrimSpace (string (out )))
15+ if err != nil {
16+ return
17+ }
18+ time .Local = timeZone
19+ }
You can’t perform that action at this time.
0 commit comments