I'm running Go version 1.3 on Windows 7x64. After I 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 has this fixed time for a reason, but I don't understand why I get this date in my box.
UPDATE: I solved 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 the computer off and on the next day.
I recommend to restart the computer after upgrading to 1.3.
In the playground the time begins at 2009-11-10 23:00:00 UTC (determining the significance of this date is an exercise for the reader). This makes it easier to cache programs by giving them deterministic output. There are also limits on execution time and on CPU and memory usage.
The Now() function in Go language is used to find the current local time. Moreover, this function is defined under the time package. Here, you need to import the “time” package in order to use these functions. Return Value: It returns the current local time.
This is the time and date of Go Lang's birthday.
They use this as the fixed time in the Go Tour, so perhaps you are running the tour.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With