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/60ac7ee0-8bb0-47c7-9218-91e08397dc57n%40googlegroups.com.

Reply via email to