Brandon Mulcahy wrote: > Is there a reason this wouldn't work? > > for { > // ... > time.Now().Format("Mon 02 Ý 15:04:05"), > // ... > time.Sleep(time.Second) > }
This would work of course, but it leaves one tiny little feature out, which I would like to have if it is basically free: Before the loop I synchronize with the whole second: // sleep until beginning of next second var now = time.Now() time.Sleep(now.Truncate(time.Second).Add(time.Second).Sub(now)) The for loop you recommended takes one second plus the time it takes to run the remainder of the loop body, while my current implementation fires exactly every one second. In my last version of the dwm status bar written as a very ugly shellscript, this effect was noticable at least once per minute: The clock would for example jump from 13:33:36 to 13:33:38. ;( --Markus