Re: [dev] golang: time.Tick() and ntp

2014-10-09 Thread Silvan Jegen
Hi Markus On Thu, Oct 09, 2014 at 01:31:53PM +0200, Markus Teich wrote: > Silvan Jegen wrote: > > I think you could use http://golang.org/pkg/time/#Time.Zone to > > occasionally check wether the time zone has changed since the script has > > been started and then use http://golang.org/pkg/time/#Pa

Re: [dev] golang: time.Tick() and ntp

2014-10-09 Thread hiro
You can also use one of those alarm clocks with radio sync for 2 euros and put it on your desk. They even come with one additional useful feature: alarms. The font is also bigger and you don't waste real-screen estate and even if something like mplayer is full-screen you don't miss the time when yo

Re: [dev] golang: time.Tick() and ntp

2014-10-09 Thread stanio
* Simon Lieb 2014-10-09 16:10 > What about using the ClkStatusText click in dwm’s config.h buttons array > to send status bar content to X selections ? what about sending date directly to X selections? :o) I mean, I get your point. Let me try another formulation: apart from looking at i

Re: [dev] golang: time.Tick() and ntp

2014-10-09 Thread stanio
* Markus Teich 2014-10-09 16:01 > I have no watch. They always break in the first year of wearing them. get an analogue, manual one, give it some love and it will love you for many years. > Also I > seldomly would like to copy the time to some place, so look-at-only is pretty > good for me. if

Re: [dev] golang: time.Tick() and ntp

2014-10-09 Thread stanio
* Martti Kühne 2014-10-09 15:59 > ...sorry, but what about screenshots? sure, it is that simple: xwd | cut -d' ' -f6-11 | ocr | xclip -i ok, I admit, I should have written “for the most part” to be correct. --s

Re: [dev] golang: time.Tick() and ntp

2014-10-09 Thread Simon Lieb
On 2014-10-09 15:54:22 +0200, sta...@cs.tu-berlin.de wrote: > the status bar is not selectable, or modifiable, it is not even > read-only (you can't save it, colpy it etc.), it is look-at-only. What about using the ClkStatusText click in dwm’s config.h buttons array to send status bar content to

Re: [dev] golang: time.Tick() and ntp

2014-10-09 Thread Markus Teich
sta...@cs.tu-berlin.de wrote: > very good point: does one need the time in the status if one has a a watch. > > the status bar is not selectable, or modifiable, it is not even read-only (you > can't save it, colpy it etc.), it is look-at-only. Heyho, I have no watch. They always break in the fir

Re: [dev] golang: time.Tick() and ntp

2014-10-09 Thread Martti Kühne
On Thu, Oct 9, 2014 at 3:54 PM, wrote: > > the status bar is not selectable, or modifiable, it is not even > read-only (you can't save it, colpy it etc.), it is look-at-only. ...sorry, but what about screenshots? cheers! mar77i

Re: [dev] golang: time.Tick() and ntp

2014-10-09 Thread stanio
* hiro 2014-10-09 15:10 > then buy a watch. very good point: does one need the time in the status if one has a a watch. the status bar is not selectable, or modifiable, it is not even read-only (you can't save it, colpy it etc.), it is look-at-only. think about this

Re: [dev] golang: time.Tick() and ntp

2014-10-09 Thread hiro
then buy a watch.

Re: [dev] golang: time.Tick() and ntp

2014-10-09 Thread Markus Teich
hiro wrote: > you can use date(1) for this. Of course, but I want to avoid starting an additional process every second just to get the time. --Markus

Re: [dev] golang: time.Tick() and ntp

2014-10-09 Thread hiro
you can use date(1) for this.

Re: [dev] golang: time.Tick() and ntp

2014-10-09 Thread Markus Teich
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 = tim

Re: [dev] golang: time.Tick() and ntp

2014-10-09 Thread Markus Teich
Silvan Jegen wrote: > I think you could use http://golang.org/pkg/time/#Time.Zone to > occasionally check wether the time zone has changed since the script has > been started and then use http://golang.org/pkg/time/#ParseInLocation to > output the time. Heyho Silvan, time.Now().Zone() does not no

Re: [dev] golang: time.Tick() and ntp

2014-10-09 Thread Silvan Jegen
On Thu, Oct 09, 2014 at 04:33:57AM +0200, Markus Teich wrote: > Silvan Jegen wrote: > > In this issue https://code.google.com/p/go/issues/detail?id=6007 in answer > > #30 > > they mention that they use a monotonic clock on Linux now with Go 1.3 and up > > which should solve this (this is the commi

Re: [dev] golang: time.Tick() and ntp

2014-10-08 Thread Brandon Mulcahy
On Thu, Oct 09, 2014 at 04:17:29AM +0200, Markus Teich wrote: > Brandon Mulcahy wrote: > > Is there a reason this wouldn't work? > > > > for { > > // ... > > time.Now().Format("Mon 02 Ý 15:04:05"), > > // ... > > time.Sleep(time.Second) > > } > > The for loop you recommended takes

Re: [dev] golang: time.Tick() and ntp

2014-10-08 Thread Markus Teich
Silvan Jegen wrote: > In this issue https://code.google.com/p/go/issues/detail?id=6007 in answer #30 > they mention that they use a monotonic clock on Linux now with Go 1.3 and up > which should solve this (this is the commit > https://code.google.com/p/go/source/detail?r=79f855ac890d ). What platf

Re: [dev] golang: time.Tick() and ntp

2014-10-08 Thread Markus Teich
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 basi

Re: [dev] golang: time.Tick() and ntp

2014-10-08 Thread Raphaël Proust
On Wed, Oct 8, 2014 at 11:23 AM, Markus Teich wrote: > 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 u

Re: [dev] golang: time.Tick() and ntp

2014-10-08 Thread Brandon Mulcahy
On Wed, Oct 08, 2014 at 12:23:59PM +0200, Markus Teich wrote: > 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

Re: [dev] golang: time.Tick() and ntp

2014-10-08 Thread Silvan Jegen
Hi On Wed, Oct 08, 2014 at 12:23:59PM +0200, Markus Teich wrote: > 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.Sec

[dev] golang: time.Tick() and ntp

2014-10-08 Thread Markus Teich
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")