Don't rely exclusively on /etc/timezone

This commit is contained in:
nemunaire 2022-12-08 10:02:08 +01:00
commit 1df1ba8996
6 changed files with 47 additions and 11 deletions

3
app.go
View file

@ -64,6 +64,7 @@ func (app *App) Start() {
Handler: app.router,
}
log.Println("Current timezone:", app.cfg.Timezone.String())
app.ResetTimer()
log.Printf("Ready, listening on %s\n", app.cfg.Bind)
@ -78,7 +79,7 @@ func (app *App) ResetTimer() {
app.nextAlarm = nil
}
if na, err := reveil.GetNextAlarm(app.db); err == nil && na != nil {
if na, err := reveil.GetNextAlarm(app.cfg, app.db); err == nil && na != nil {
app.nextAlarm = time.AfterFunc(time.Until(*na), func() {
app.nextAlarm = nil
reveil.RemoveOldAlarmsSingle(app.db)