diff options
| author | nsfisis <nsfisis@gmail.com> | 2021-11-13 12:23:44 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2021-11-13 12:23:44 +0900 |
| commit | 0a93290553cc3d130cf03ae242c03b2b2913198f (patch) | |
| tree | 516701142b231c2486069ff5a80ba3a484d8b7c2 /main.go | |
| parent | 7f4e56cb3485bf9390633533428e2c5015741631 (diff) | |
| download | big-clock-mode-0a93290553cc3d130cf03ae242c03b2b2913198f.tar.gz big-clock-mode-0a93290553cc3d130cf03ae242c03b2b2913198f.tar.zst big-clock-mode-0a93290553cc3d130cf03ae242c03b2b2913198f.zip | |
performance: reduce redraw
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -180,13 +180,17 @@ func main() { t := time.NewTimer(30 * time.Second) defer t.Stop() + prev := time.Now() for { select { case <-quitC: return - case <-t.C: - drawClock(scr, time.Now(), bgStyle, clockStyle) - scr.Show() + case now := <-t.C: + if now.Minute() != prev.Minute() { + drawClock(scr, now, bgStyle, clockStyle) + scr.Show() + prev = now + } } } } |
