FWIW, based on a quick test, setting TZ="" also leads to a non-nil loc field: https://play.golang.org/p/LJJSTq7R1NA So, `time.Local = time.UTC` at least shouldn't lead to more adverse effects than setting TZ="".
On Thu, Oct 28, 2021 at 8:58 AM Uli Kunitz <uli.kun...@gmail.com> wrote: > I believe time.Local = time.UTC is the right approach. It is true that the > loc field of the time structure will be set to &UTC and not zero, but I > couldn't find a path where this should generate a problem. From my point of > view I would regard any issue resulting from it as a bug. > > Uli > > On Thursday, October 28, 2021 at 4:05:00 AM UTC+2 Ian Lance Taylor wrote: > >> On Wed, Oct 27, 2021 at 4:28 PM Radu Berinde <ra...@cockroachlabs.com> >> wrote: >> > >> > > The argument here >> > is that a program would only call the UTC method if it wants to change >> > the way that those conversions work, so it presumably cares about the >> > wall time, not monotonic time. >> > >> > But in those contexts, the monotonic time wouldn't make a difference - >> so what is the upside of stripping it? Are there cases I'm not seeing where >> the mono time would interfere with these "standard" usage patterns? >> >> That's true, keeping the monotonic time wouldn't make much difference. >> Stripping it gives you consistent behavior with things like time.Sub, >> but I agree that it's not a major point. But I don't think we can >> really change the behavior now. >> >> Ian >> > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/e489b1b5-e42c-4a1e-aa91-4ffa644e5b48n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/e489b1b5-e42c-4a1e-aa91-4ffa644e5b48n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAEkBMfFEigf-U3YqE936Yy2e2KFwMe19vSd2JESnWjAqXjYW8g%40mail.gmail.com.