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: document that a marshaled time does not include location name #28421
As a hallmark example of the problem here is to ask: what month will it be if you add 2840 hours to the reference time used for string formatting? See: https://play.golang.org/p/XQiDRKpKtSa
Overall, this subtlety breaks assumptions that encoded timestamps convey all the information on the original
The proposal is to do one or more of the following options. Note that as the author here, my current thinking is option 2 plus option 5 would be the best way forward, but I've listed more possibilities for completeness.
This will allow
This idea is less transparent than the Binary/Gob approach because it requires specifically using a format that includes location. This means it's backward compatible and introduces minimal additional API surface. This possibility still must tackle the problem of how to proceed on systems without available tzdata.
Because the current JSON/text encoding mechanisms for
The two major downsides to this approach I can think of:
The big benefit here would be to make
It's worth warning people that existing encoding methods do not preserve the full location information and that if the program needs to do calendrical operations which may be affected by changes like DST, to transmit/store both the encoded
edit: added some formatting
After discussion with the proposal committee, we agreed it's best to go with option 5 and document the behavior since you can implement option 2 on your own without any changes to the standard library.
Accepting this proposal to document the behavior only. Thanks.