Heyho, I am using a status bar script written in go[0]. Recently I have noticed two problems related to the time display, but first here is the relevant part of the code:
for clock := range time.Tick(time.Second) { // … clock.Format("Mon 02 15:04:05") // … } Now the first problem occured when I was travelling to another timezone and updated my timezone information. Since clock only get's initialized once, we don't catch the new timezone info and the displayed time stays in the old timezone until the script is restarted. The second problem is when using ntp to synchronize the clock. In this case the channel provided by time.Tick() stops to send on that channel and therefore the whole loop stops and the status bar is not updated anymore. Can you help me with an idiomatic solution for these two problems? The first one can be solved by using „time.Now()“ instead of „clock“ inside the loop, but I'm stuck with the second one since I don't see a way to detect this case easily. Maybe I could introduce another timeout channel which fires after two seconds on a monotonic clock? Thanks for your suggestions. --Markus [0] https://github.com/schachmat/gods