scheduler: fix runtime reset when date changes
Signed-off-by: Thomas Klaehn <tkl@blackfinn.de>
This commit is contained in:
@@ -124,11 +124,13 @@ func poll_auto_off() {
|
||||
// check date change
|
||||
now := time.Now()
|
||||
if now.After(today) {
|
||||
logger.Print("date change detected")
|
||||
// reset date
|
||||
today = time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 0, now.Location())
|
||||
for _, od := range app_state_cache.off_devices {
|
||||
devices := apiservice_devices.GetDevices()
|
||||
for _, d := range devices.Devices {
|
||||
// reset run times
|
||||
apiservice_state.SetRuntime(od.device.Name, 0)
|
||||
apiservice_state.SetRuntime(d.Name, 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user