I would like to understand the reasoning for the implementation, if possible.
Simple example: I have a laptop running Ubuntu (or any other popular Linux distro). I fly from New Zealand to Los Angeles I open my laptop and change the timezone via the system GUI (which under the hood uses timedatectl which updates /etc/timezone and /etc/localtime) If I had running services written in Go, they would not be aware of the timezone change. Questions I have: Why doesn't Go respect standard time zone changes? Is there a recommended way to address this? Cheers, Carl PS> I'm aware of https://github.com/golang/go/issues/28020 but would really like to know the reasoning behind caching the timezone and not invalidating the cache when it changes. On Friday, February 11, 2022 at 8:52:24 AM UTC+13 lege...@gmail.com wrote: > > I find a way to work around. > > The goal is to get the valid timezone of the system periodically in my > application, So I try to get the valid timezone name from the file > /etc/timezone and then parse it to the necessary object I need, to avoid > accessing the file too often, I add a cache for the timezone. It's not a > perfect solution, but I think it's enough for my scenario. > On Wednesday, February 9, 2022 at 5:16:28 PM UTC-8 Ian Lance Taylor wrote: > >> On Wed, Feb 9, 2022 at 3:37 PM E Z <lege...@gmail.com> wrote: >> > >> > I noticed a phenomenon while maintaining my golang application, the >> local timezone of the application always keep the value when it starts, the >> local timezone will not change even though I change the system timezone. It >> looks like the golang time package has been caching the current timezone. >> > >> > Is there any way to change the local timezone in the golang application >> as the system's timezone changes? >> >> htttps://go.dev/issue/28020 >> >> 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/9a0ef3b6-ab7a-434b-bd0d-16c2f805fb08n%40googlegroups.com.