New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
time: ParseInLocation incorrect after 2038 #25343
Comments
GMT = UTC+0, Greenwich Mean Time Times after 2038 seem to stop adjusting to or from daylight saving zones, because the time exceeds the available timezone transitions. Instead, the latest available zone transition is returned. It may or may not be in daylight saving. See Location.lookup. Zone transitions are derived either from the system timezone db (eg /etc/timezone) or from a local copy (eg, $GOROOT/lib/time/zoneinfo.zip). This can be selected by the ZONEINFO env var. Zone transitions are parsed in LoadLocationFromTZData
That code comment might not be correct. The year 2106 is the limit of unsigned 32 bit integer seconds since the epoch, but the timezone information format states These 32-bit values are limited to representing times no later than 19 January, 2038 03:14:07 UTC. (max signed 32 bit int since unix epoch). Looks like zone transitions beyond 2038 won't be parsed, even if available in source timezone data. Also, extended data is excluded from Go's zoneinfo.zip, to reduce file size. In lib/time/update.bash:
|
IANA's documentation (https://data.iana.org/time-zones/theory.html) mentions the issue, with a presumption that 64-bit values are expected:
Is it the feeling here that Go should be using 64-bit values for TZ-related time? |
Thank you for the report @jimcheetham and welcome to the Go project! Thank you too @mdcnz for the discussion and debugging. So we didn't get to this during Go1.12 but I'll punt it for investigation for Go1.13 and @mdcnz if you'd like to take a deeper stab at this during Go1.13, all yours :) I'll also page some other folks too @robpike @ALTree @ianlancetaylor |
Gregorian 2038 is the maximum year reachable with the 32-bit signed version from epoch. The tz database used by Go and others introduces issues beyond 2038 and falls back on defaults during that year for daylight saving time between others. This is a known effect as icann mentions. Specifically for Daylight Saving Time (anywhere), its future is not definite beyond 2038. Current behavior seems appropriate. |
I think that the Go library is correctly reporting what the TZ database supports. The Go library does now use the extended data, for #30099. I don't think there is anything to do here on the Go side. Please comment if you disagree. |
Are you suggesting that the changes referred to in #30099 (https://golang.org/cl/161202) have caused an improvement in this situation? If so, excellent :-) |
They may have improved the situation. I don't know for sure. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go1.10.2
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?using https://play.golang.org
What did you do?
Used time.ParseInLocation to grok a time from "Europe/London"
Noticed that the resulting time switched from BST (appropriate for the month/day used) to GMT after 2038
https://play.golang.org/p/5oMrjFT_3F1
What did you expect to see?
The 2038 date as BST, the same as the 2037 date. See this example of GNU coreutils 8.26 date() :
What did you see instead?
The text was updated successfully, but these errors were encountered: