Re: [dev] golang: time.Tick() and ntp
Brandon Mulcahy wrote:
> I think a "correct" solution would be:
>
> time.Sleep(-time.Since(time.Now().Add(time.Second).Truncate(time.Second)))
Thanks for the hint Brandon,
however I just shifted the delay before the loop inside. I think it's a little
bit more readable:
var now = time.Now()
time.Sleep(now.Truncate(time.Second).Add(time.Second).Sub(now))
--Markus
Received on Thu Oct 09 2014 - 13:36:23 CEST
This archive was generated by hypermail 2.3.0
: Thu Oct 09 2014 - 13:48:07 CEST