Merge pull request #1009 from NeroBurner/AlarmController_allow_less_precice_system_time

AlarmController: allow loss of precision for alarmTime cast
This commit is contained in:
Riku Isokoski 2022-04-18 19:42:09 +03:00 committed by GitHub
commit ff73f67d6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,7 +54,8 @@ void AlarmController::ScheduleAlarm() {
auto now = dateTimeController.CurrentDateTime(); auto now = dateTimeController.CurrentDateTime();
alarmTime = now; alarmTime = now;
time_t ttAlarmTime = std::chrono::system_clock::to_time_t(alarmTime); time_t ttAlarmTime = std::chrono::system_clock::to_time_t(
std::chrono::time_point_cast<std::chrono::system_clock::duration>(alarmTime));
tm* tmAlarmTime = std::localtime(&ttAlarmTime); tm* tmAlarmTime = std::localtime(&ttAlarmTime);
// If the time being set has already passed today,the alarm should be set for tomorrow // If the time being set has already passed today,the alarm should be set for tomorrow