Golang time.Now()始终是2009-11-10 23:00:00 +0000 UTC [英] Golang time.Now() is always 2009-11-10 23:00:00 +0000 UTC
问题描述
在Windows 7x64上运行Go 1.3版后,运行以下代码,我总是收到 2009-11-10 23:00:00 +0000 UTC
包主
导入(
fmt
时间
)
func main(){
fmt.Println(time.Now())
}
我知道playgroud有这个固定的时间有一个原因,但我不明白为什么我在我的箱子里得到这个日期
更新:
我通过将go版本从1.2.2升级到1.3而意识到了这个问题
试图重现这个问题,我意识到了这一点在第二天关机并在电脑上被修复。
我推荐在升级到1.3后重新启动计算机。
这段时间是Go Tour中使用的固定时间,如浏览限制
在操场上,时间开始于2009-11-10 23:00:00 UTC(确定此日期的重要性是为读者)。这使得缓存程序的过程变得更容易。通过赋予它们确定性的输出。
你确定你没有在那里运行代码吗?
可能是本地版本 - 您可以下载并运行游览。
im running Go version 1.3 on windows 7x64, after run the following code i always get 2009-11-10 23:00:00 +0000 UTC
package main
import (
"fmt"
"time"
)
func main() {
fmt.Println(time.Now())
}
i know that go playgroud have this fixed time for one reason, but i don't understand why i get this date in my box
UPDATE: I realized this issue by upgrading the go version from 1.2.2 to 1.3
Trying to reproduce the issue, i realized this had been fixed after switching off and on computer next day.
I recommend to restart the computer after upgrading to 1.3
That time is the fixed time used in the Go Tour as mentioned in the Go Tour limitations
In the playground the time begins at 2009-11-10 23:00:00 UTC (determining the sigificance of this date is an exercise for the reader). This makes it easier to cache programs by giving them deterministic output.
Are you sure you were not running code there? Possibly local version - you can download and run the tour.
这篇关于Golang time.Now()始终是2009-11-10 23:00:00 +0000 UTC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!