diff options
| author | Reinhold Gschweicher <pyro4hell@gmail.com> | 2022-03-14 19:28:51 (GMT) |
|---|---|---|
| committer | Reinhold Gschweicher <pyro4hell@gmail.com> | 2022-03-14 19:59:44 (GMT) |
| commit | db41d9081a61b2370a4633568a9cb01bc948a5ab (patch) | |
| tree | bfc24de6ccbe23878bb2501be83e3c48eb6795c9 | |
| parent | 21da5869c5e48df666ea9d9c7698f7f69528645e (diff) | |
DateTimeController: make possible functions const
MonthShortToString and DayOfWeekShortToString don't change the
underlying object. Those are just getters and can be declared `const`.
| -rw-r--r-- | src/components/datetime/DateTimeController.cpp | 4 | ||||
| -rw-r--r-- | src/components/datetime/DateTimeController.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/components/datetime/DateTimeController.cpp b/src/components/datetime/DateTimeController.cpp index e0d1243..3bfbdc7 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<uint8_t>(month)]; } -const char* DateTime::DayOfWeekShortToString() { +const char* DateTime::DayOfWeekShortToString() const { return DaysStringShort[static_cast<uint8_t>(dayOfWeek)]; } diff --git a/src/components/datetime/DateTimeController.h b/src/components/datetime/DateTimeController.h index 6e5ee3c..00bbc2e 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<std::chrono::system_clock, std::chrono::nanoseconds> CurrentDateTime() const { |
