Re: [go-nuts] how to control the timezone of time.Now()

2021-10-28 Thread 'Axel Wagner' via golang-nuts
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 wrote: > I believe time.Local = time.UTC

Re: [go-nuts] how to control the timezone of time.Now()

2021-10-27 Thread Uli Kunitz
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 Thursd

Re: [go-nuts] how to control the timezone of time.Now()

2021-10-27 Thread Ian Lance Taylor
On Wed, Oct 27, 2021 at 4:28 PM Radu Berinde 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 tim

Re: [go-nuts] how to control the timezone of time.Now()

2021-10-27 Thread 'Radu Berinde' via golang-nuts
Hi Ian, > 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 s

Re: [go-nuts] how to control the timezone of time.Now()

2021-10-27 Thread Ian Lance Taylor
On Wed, Oct 27, 2021 at 3:37 PM Andrei Matei wrote: > > At least for my edification, though, I would benefit from a commentary > about why exactly it is that UTC() strips the monos, if you happen to > understand it. The only thing comment on the topic I found is here, from Russ: > He said: > > I s

Re: [go-nuts] how to control the timezone of time.Now()

2021-10-27 Thread 'Andrei Matei' via golang-nuts
On Tue, Oct 26, 2021 at 6:09 PM Ian Lance Taylor wrote: > On Tue, Oct 26, 2021 at 2:07 PM Andrei Matei > wrote: > > > > If you accept that there are reasons for setting TZ for a particular > program, then > > would you also agree that there are reasons for wanting to do the same > from inside >

Re: [go-nuts] how to control the timezone of time.Now()

2021-10-26 Thread Ian Lance Taylor
On Tue, Oct 26, 2021 at 2:07 PM Andrei Matei wrote: > > If you accept that there are reasons for setting TZ for a particular program, > then > would you also agree that there are reasons for wanting to do the same from > inside > the program? We distribute our software for others to run, so we d

Re: [go-nuts] how to control the timezone of time.Now()

2021-10-26 Thread 'Andrei Matei' via golang-nuts
On Tue, Oct 26, 2021 at 3:15 PM Ian Lance Taylor wrote: > On Tue, Oct 26, 2021 at 11:58 AM 'Andrei Matei' via golang-nuts > wrote: > > > > I'm finding it difficult to satisfactorily control the timezone used by > the time.Now() function. The Go team have taken positions in the past that > seem t

Re: [go-nuts] how to control the timezone of time.Now()

2021-10-26 Thread Ian Lance Taylor
On Tue, Oct 26, 2021 at 11:58 AM 'Andrei Matei' via golang-nuts wrote: > > I'm finding it difficult to satisfactorily control the timezone used by the > time.Now() function. The Go team have taken positions in the past that seem > to not make this easy; I'd like to see if I can gather sympathy f

[go-nuts] how to control the timezone of time.Now()

2021-10-26 Thread 'Andrei Matei' via golang-nuts
Hello Go friends, I'm finding it difficult to satisfactorily control the timezone used by the time.Now() function. The Go team have taken positions in the past that seem to not make this easy; I'd like to see if I can gather sympathy for changes, or perhaps if there's some obvious idea that I'm mi