From db41d9081a61b2370a4633568a9cb01bc948a5ab Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Mon, 14 Mar 2022 20:28:51 +0100 Subject: DateTimeController: make possible functions const MonthShortToString and DayOfWeekShortToString don't change the underlying object. Those are just getters and can be declared `const`. --- src/components/datetime/DateTimeController.cpp | 4 ++-- src/components/datetime/DateTimeController.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/components/datetime/DateTimeController.cpp b/src/components/datetime/DateTimeController.cpp index e0d12431..3bfbdc7e 100644 --- a/src/components/datetime/DateTimeController.cpp +++ b/src/components/datetime/DateTimeController.cpp @@ -108,11 +108,11 @@ void DateTime::UpdateTime(uint32_t systickCounter) { } } -const char* DateTime::MonthShortToString() { +const char* DateTime::MonthShortToString() const { return MonthsString[static_cast(month)]; } -const char* DateTime::DayOfWeekShortToString() { +const char* DateTime::DayOfWeekShortToString() const { return DaysStringShort[static_cast(dayOfWeek)]; } diff --git a/src/components/datetime/DateTimeController.h b/src/components/datetime/DateTimeController.h index 6e5ee3ca..00bbc2ee 100644 --- a/src/components/datetime/DateTimeController.h +++ b/src/components/datetime/DateTimeController.h @@ -61,8 +61,8 @@ namespace Pinetime { return second; } - const char* MonthShortToString(); - const char* DayOfWeekShortToString(); + const char* MonthShortToString() const; + const char* DayOfWeekShortToString() const; static const char* MonthShortToStringLow(Months month); std::chrono::time_point CurrentDateTime() const { -- cgit v1.2.3 From bebc072e78145af69aacb1c2c9549da8653b7b0c Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Mon, 14 Mar 2022 20:55:20 +0100 Subject: WatchFaceAnalog: const ref to dateTimeController The clock app only reads from the dateTimeController, never modifies it. --- src/displayapp/screens/WatchFaceAnalog.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/displayapp/screens/WatchFaceAnalog.h b/src/displayapp/screens/WatchFaceAnalog.h index a18eb299..3377d39e 100644 --- a/src/displayapp/screens/WatchFaceAnalog.h +++ b/src/displayapp/screens/WatchFaceAnalog.h @@ -74,7 +74,7 @@ namespace Pinetime { lv_obj_t* batteryIcon; lv_obj_t* notificationIcon; - Controllers::DateTime& dateTimeController; + const Controllers::DateTime& dateTimeController; Controllers::Battery& batteryController; Controllers::Ble& bleController; Controllers::NotificationManager& notificationManager; -- cgit v1.2.3