On Wed, 9 Feb 2022 at 23:36, E Z <legend...@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 >
See https://cs.opensource.google/go/go/+/refs/tags/go1.17.6:src/time/zoneinfo.go and https://cs.opensource.google/go/go/+/refs/tags/go1.17.6:src/time/zoneinfo_unix.go -- there is a sync.Once to set it. I would have thought changing the timezone underneath a running program would not be a good idea due to it often not being an atomic swap. M -- 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/CADLW2vwncsQiWXmuGVgCCoJh8pzTfXGw4ioeVgnPG07M91TDAQ%40mail.gmail.com.