我在Windows 7x64上运行Go 1.3版,运行以下代码后我总是得到2009-11-10 23:00:00 +0000 UTC
package main
import (
"fmt"
"time"
)
func main() {
fmt.Println(time.Now())
}
Run Code Online (Sandbox Code Playgroud)
我知道gogroud有这个固定的时间有一个原因,但我不明白为什么我在我的盒子里得到这个日期
更新: 我通过将go版本从1.2.2升级到1.3来实现了这个问题
试图重现这个问题,我意识到这已经在第二天关机后在电脑上修复了.
我建议在升级到1.3后重新启动计算机
Mat*_*gan 28
该时间是Go Tour限制中提到的Go Tour中使用的固定时间
在操场上,时间从2009-11-10 23:00:00 UTC开始(确定此日期的重要性是读者的练习).这使得通过为程序提供确定性输出来更容易地缓存程序.
你确定你没有在那里运行代码吗?可能是本地版本 - 您可以下载并运行导览.
我无法重现您的问题:
C:\gopath\src\timenow>go version
go version go1.3 windows/amd64
C:\gopath\src\timenow>go env
set GOARCH=amd64
set GOBIN=C:\go\bin
set GOCHAR=6
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\gopath
set GORACE=
set GOROOT=C:\go
set GOTOOLDIR=C:\go\pkg\tool\windows_amd64
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
C:\gopath\src\timenow>type timenow.go
package main
import (
"fmt"
"time"
)
func main() {
fmt.Println(time.Now())
}
C:\gopath\src\timenow>go run timenow.go
2014-07-02 17:33:20.3270287 -0400 EDT
C:\gopath\src\timenow>time
The current time is: 17:33:23.60
Enter the new time:
C:\gopath\src\timenow>
Run Code Online (Sandbox Code Playgroud)
运行这些命令会得到什么输出?
| 归档时间: |
|
| 查看次数: |
31209 次 |
| 最近记录: |