From f699261ca326c76b72a864cb9576cf4c69bd5474 Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Mon, 26 Sep 2022 21:39:41 +0200 Subject: [PATCH] AlarmController: add const to SecondsToAlarm() function The function `SecondsToAlarm()` doesn't change anything in the `AlarmController` object. Mark the function `const` to show this property. --- src/components/alarm/AlarmController.cpp | 2 +- src/components/alarm/AlarmController.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/alarm/AlarmController.cpp b/src/components/alarm/AlarmController.cpp index 9f4e9105..d97e1cff 100644 --- a/src/components/alarm/AlarmController.cpp +++ b/src/components/alarm/AlarmController.cpp @@ -82,7 +82,7 @@ void AlarmController::ScheduleAlarm() { state = AlarmState::Set; } -uint32_t AlarmController::SecondsToAlarm() { +uint32_t AlarmController::SecondsToAlarm() const { return std::chrono::duration_cast(alarmTime - dateTimeController.CurrentDateTime()).count(); } diff --git a/src/components/alarm/AlarmController.h b/src/components/alarm/AlarmController.h index d630a128..91f60f5a 100644 --- a/src/components/alarm/AlarmController.h +++ b/src/components/alarm/AlarmController.h @@ -36,7 +36,7 @@ namespace Pinetime { void ScheduleAlarm(); void DisableAlarm(); void SetOffAlarmNow(); - uint32_t SecondsToAlarm(); + uint32_t SecondsToAlarm() const; void StopAlerting(); enum class AlarmState { Not_Set, Set, Alerting }; enum class RecurType { None, Daily, Weekdays };