Closed jinfengnarvar closed 5 years ago
/cc @ALTree @ianlancetaylor
Change https://golang.org/cl/161202 mentions this issue: time: read 64-bit data if available
This is happening because we were only reading the 32-bit version of the tzdata info, which can't represent times before December 13, 1901.
@ianlancetaylor What about "Asia/Calcutta", of which the anomaly seems to continue beyond 1901.
It seems to me that with CL 161202 the times printed for "Asia/Calcutta" match the information in the tzdata database.
# Reed S, Low F. The Indian Year Book 1936-37. Bennett, Coleman, pp 27-8.
# https://archive.org/details/in.ernet.dli.2015.282212
# This lists +052110 as Madras local time used in railways, and says that on
# 1906-01-01 railways and telegraphs in India switched to +0530. Some
# municipalities retained their former time, and the time in Calcutta
# continued to depend on whether you were at the railway station or at
# government offices. Government time was at +055320 (according to Shanks) or
# at +0554 (according to the Indian Year Book). Railway time is more
# appropriate for our purposes, as it was better documented, it is what we do
# elsewhere (e.g., Europe/London before 1880), and after 1906 it was
# consistent in the region now identified by Asia/Kolkata. So, use railway
# time for 1870-1941. Shanks is our only (and dubious) source for the
# 1941-1945 data.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Kolkata 5:53:28 - LMT 1854 Jun 28 # Kolkata
5:53:20 - HMT 1870 # Howrah Mean Time?
5:21:10 - MMT 1906 Jan 1 # Madras local time
5:30 - IST 1941 Oct
5:30 1:00 +0630 1942 May 15
5:30 - IST 1942 Sep
5:30 1:00 +0630 1945 Oct 15
5:30 - IST
Thanks @ianlancetaylor for investigation! And thanks @bradfitz for including the issue for next release!
In the meantime, I have my own wrapper around time.Date and limit the year to 1970 (an arbitrarily picked year that is just old enough :)
@ianlancetaylor which version of go has this 64-bit reading fix been ported in? the label says go1.13, but I'm wondering if 1.12.4 has it or not, seems like my repro test works correctly now under 1.12.4.
@jinfengnarvar The patch that fixed the problem is not on the 1.12 branch. I have no explanation. Perhaps the tzdata information on your system changed in some way?
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Don't know. I did repro this issue on https://play.golang.org/.
What operating system and processor architecture are you using (
go env
)?What did you do?
Here is the repro code:
What did you expect to see?
What did you see instead?
Similar output for "Asia/Calcutta" time zone, except the deviation lasts through 1905: