aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2021-11-13 12:23:44 +0900
committernsfisis <nsfisis@gmail.com>2021-11-13 12:23:44 +0900
commit0a93290553cc3d130cf03ae242c03b2b2913198f (patch)
tree516701142b231c2486069ff5a80ba3a484d8b7c2
parent7f4e56cb3485bf9390633533428e2c5015741631 (diff)
downloadbig-clock-mode-0a93290553cc3d130cf03ae242c03b2b2913198f.tar.gz
big-clock-mode-0a93290553cc3d130cf03ae242c03b2b2913198f.tar.zst
big-clock-mode-0a93290553cc3d130cf03ae242c03b2b2913198f.zip
performance: reduce redraw
-rw-r--r--main.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/main.go b/main.go
index 332e910..f4c4396 100644
--- a/main.go
+++ b/main.go
@@ -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
+ }
}
}
}