4 Star 6 Fork 4

王军/golib

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 518 Bytes
一键复制 编辑 原始数据 按行查看 历史
王军 提交于 2025-01-05 17:39 +08:00 . 修复js export 特殊情况崩溃的问题
package main
import (
"flag"
"time"
"gitee.com/haodreams/golib/ntp"
)
var plocal = flag.Bool("local", false, "local time")
func main() {
flag.Parse()
ntps := []string{"ntp.ntsc.ac.cn:123", "0.pool.ntp.org:123", "1.pool.ntp.org:123", "2.pool.ntp.org:123", "3.pool.ntp.org:123"}
for _, n := range ntps {
tm, err := ntp.GetNetworkTime(n)
if err != nil {
continue
}
if *plocal {
now := tm.UTC().In(time.Local)
SetTime(now)
} else {
SetTime(*tm)
}
break
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/haodreams/golib.git
git@gitee.com:haodreams/golib.git
haodreams
golib
golib
v1.0.0

搜索帮助