Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
time: (*Time).Unix not equal in location Asia/Shanghai #37277
What version of Go are you using (
I don't think this is a bug.
If you print out t1 directly, you should get "1890-01-01 00:00:00 +0805 LMT".
The IANA time zone database (https://www.iana.org/time-zones) uses local mean time (LMT) until 1901 for Shanghai and assumes a time difference of +08:05:43 to UTC, in 1890 this was Greenwich Mean Time (GMT).
Your program is using time.Unix() to convert the Unix time to the local time zone and it appears that it is set to China Standard Time (+08:00) and this results in the difference of 5 minutes and 43 seconds.
I will work on a demo program to make that more transparent.