diff options
| author | Reinhold Gschweicher <pyro4hell@gmail.com> | 2022-02-21 22:45:59 (GMT) |
|---|---|---|
| committer | Reinhold Gschweicher <pyro4hell@gmail.com> | 2022-03-29 19:25:22 (GMT) |
| commit | 78cab3604d307d48db5d2b38b54a00bbaaaf67ec (patch) | |
| tree | cbaaf3b6dd329e14b3a7f62ae9aa4f08c51720b4 /src/components/alarm/AlarmController.cpp | |
| parent | 8f436e1d74ffdd497c68dc2f34f6a67e430a1932 (diff) | |
AlarmController: allow loss of precision for alarmTime cast
Allow a loss of precision if the system clock has a lower resolution
than nanoseconds. This is the case for web assembly.
Diffstat (limited to 'src/components/alarm/AlarmController.cpp')
| -rw-r--r-- | src/components/alarm/AlarmController.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/components/alarm/AlarmController.cpp b/src/components/alarm/AlarmController.cpp index 28b328d..11d96e7 100644 --- a/src/components/alarm/AlarmController.cpp +++ b/src/components/alarm/AlarmController.cpp @@ -54,7 +54,8 @@ void AlarmController::ScheduleAlarm() { auto now = dateTimeController.CurrentDateTime(); 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); // If the time being set has already passed today,the alarm should be set for tomorrow |
