summaryrefslogtreecommitdiff
path: root/status
diff options
context:
space:
mode:
Diffstat (limited to 'status')
-rw-r--r--status/04-date.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/status/04-date.go b/status/04-date.go
index cd8f7f2..fba68d6 100644
--- a/status/04-date.go
+++ b/status/04-date.go
@@ -17,7 +17,23 @@ func date(b *Block) error {
// Sleep til the next day comes around
tmrw := time.Now().AddDate(0, 0, 1)
tmrw = time.Date(tmrw.Year(), tmrw.Month(), tmrw.Day(), 0, 0, 0, 0, time.Local)
- time.Sleep(time.Until(tmrw))
+
+ var until time.Duration
+ until = time.Until(tmrw)
+
+ // Previously this status would sleep all the way until the next day.
+ // This worked fine until the device entered sleep/hibernation
+ //
+ // Therefore a limit was added. Not the ideal solution,
+ // as if the device is woken within config.MaxSleep,
+ // then the date will not update until some extra time has elapsed.
+ //
+ // TODO: a better solution
+ if (until > config.MaxSleep) {
+ until = config.MaxSleep
+ }
+
+ time.Sleep(until)
}
_, err := b.drawText(0, config.Fg, time.Now().Local().Format("Mon 02/01"))