Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
time: ParseInLocation incorrect after 2038 #25343
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
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?
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