You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Start calendar is adjusted to the stored start hour and minute of the day the instance was created
End Calendar is set to right now
End calendar is adjusted to the stored end hour and minute of the day the instance was created
Check that if the end datetime is before the start datetime add a day to the end calendar
It seems like this logic might not be right.
Assume Start is set to 22:00
Assume End is set to 8:00
Assume checkAutoSleepTimer is run at 2023-03-27-00:30
Start calendar is 2023-03-27-22:00
End Calendar is 2023-03-27-08:00
2023-03-27-08:00 is before 2023-03-27-22:00
End calendar becomes 2023-03-28-08:00
Window is now Start: 2023-03-27-22:00 - End: 2023-03-28-08:00
Current time is 2023-03-27-00:30
Current time is outside of start window
auto sleep time is not started
With out logs I can't verify this, but I believe this is a logic bug and is causing my sleep timer to not reset after midnight.
val startCalendar =Calendar.getInstance()
startCalendar.set(Calendar.HOUR_OF_DAY, deviceSettings.autoSleepTimerStartHour)
startCalendar.set(Calendar.MINUTE, deviceSettings.autoSleepTimerStartMinute)
val endCalendar =Calendar.getInstance()
endCalendar.set(Calendar.HOUR_OF_DAY, deviceSettings.autoSleepTimerEndHour)
endCalendar.set(Calendar.MINUTE, deviceSettings.autoSleepTimerEndMinute)
// In cases where end time is earlier then start time then we add a day to end time// e.g. start time 22:00 and end time 06:00. End time will be treated as 6am the next day.// e.g. start time 08:00 and end time 22:00. Start and end time will be the same day.if (endCalendar.before(startCalendar)) {
endCalendar.add(Calendar.DAY_OF_MONTH, 1)
}
It seems like this logic might not be right.
checkAutoSleepTimer
is run at 2023-03-27-00:30With out logs I can't verify this, but I believe this is a logic bug and is causing my sleep timer to not reset after midnight.
Originally posted by @chrishoage in #636 (reply in thread)
The text was updated successfully, but these errors were encountered: