Home >Backend Development >Golang >Why Does Go's `time.Now()` Sometimes Return '2009-11-10 23:00:00 UTC'?
Why Does Go's 'time.Now()' Return a Fixed Date of 2009-11-10 23:00:00 UTC?
In Go version 1.3 running on Windows 7x64, the time.Now() function inexplicably returns "2009-11-10 23:00:00 0000 UTC" instead of the current time. This anomaly pertains not only to the Go Playground, which has a known fixed time, but also to local installations.
Root Cause and Resolution
The root cause of this issue lies in a bug in the version of Go used. Upgrading to Go versions 1.2.2 or 1.3 resolved the problem.
Interestingly, restarting the computer after upgrading to 1.3 also fixed the issue, suggesting that the operating system may have cached the invalid time value.
Historical Significance
The date "2009-11-10 23:00:00 0000 UTC" holds special significance in the Go community. It represents the birthday of the Go language, which was officially released on that date. This explains its use as the fixed time in the Go Tour.
The above is the detailed content of Why Does Go's `time.Now()` Sometimes Return '2009-11-10 23:00:00 UTC'?. For more information, please follow other related articles on the PHP Chinese website!