summaryrefslogtreecommitdiff
path: root/.config/wmii-hg/rbar_clock.go
blob: 247dd3a2eb8fbf7e6cb898979c3f94b18a305f3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main

import (
	"time"

	"./rbar_util"
)

func main() {
	rbar_util.Main(rbar_util.Impl{
		Update: func(id string) error {
			defer rbar_util.Remove(rbar_util.GlobEscape(id))

			now := time.Now()
			start := now.Truncate(time.Second).Add(time.Second)
			time.Sleep(start.Sub(now))

			clock := time.NewTicker(1*time.Second)
			defer clock.Stop()
			for now := range clock.C {
				err := rbar_util.Write(id, now.Format("label Mon 2006-01-02 15:04:05 MST(-07)"))
				if err != nil {
					return err
				}
			}
			panic("not reached")
		},
	})
}