From 7cbd56896aebcebaacae864403b91473986782a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Milants?= Date: Sun, 10 Oct 2021 16:08:19 +0200 Subject: [PATCH] DateTimeController : remove unused methods and variables. --- .../datetime/DateTimeController.cpp | 70 +++---------------- src/components/datetime/DateTimeController.h | 20 ------ 2 files changed, 9 insertions(+), 81 deletions(-) diff --git a/src/components/datetime/DateTimeController.cpp b/src/components/datetime/DateTimeController.cpp index 26b69a27..e9c5d870 100644 --- a/src/components/datetime/DateTimeController.cpp +++ b/src/components/datetime/DateTimeController.cpp @@ -5,6 +5,12 @@ using namespace Pinetime::Controllers; +namespace { + char const* DaysStringShort[] = {"--", "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"}; + char const* MonthsString[] = {"--", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"}; + char const* MonthsStringLow[] = {"--", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; +} + void DateTime::SetCurrentTime(std::chrono::time_point t) { this->currentDateTime = t; UpdateTime(previousSystickCounter); // Update internal state without updating the time @@ -80,76 +86,18 @@ void DateTime::UpdateTime(uint32_t systickCounter) { } const char* DateTime::MonthShortToString() { - return DateTime::MonthsString[static_cast(month)]; -} - -const char* DateTime::MonthShortToStringLow() { - return DateTime::MonthsStringLow[static_cast(month)]; -} - -const char* DateTime::MonthsToStringLow() { - return DateTime::MonthsLow[static_cast(month)]; -} - -const char* DateTime::DayOfWeekToString() { - return DateTime::DaysString[static_cast(dayOfWeek)]; + return MonthsString[static_cast(month)]; } const char* DateTime::DayOfWeekShortToString() { - return DateTime::DaysStringShort[static_cast(dayOfWeek)]; -} - -const char* DateTime::DayOfWeekToStringLow() { - return DateTime::DaysStringLow[static_cast(dayOfWeek)]; -} - -const char* DateTime::DayOfWeekShortToStringLow() { - return DateTime::DaysStringShortLow[static_cast(dayOfWeek)]; -} - -const char* DateTime::MonthShortToString(Months month) { - return DateTime::MonthsString[static_cast(month)]; + return DaysStringShort[static_cast(dayOfWeek)]; } const char* DateTime::MonthShortToStringLow(Months month) { - return DateTime::MonthsStringLow[static_cast(month)]; -} - -const char* DateTime::MonthsToStringLow(Months month) { - return DateTime::MonthsLow[static_cast(month)]; -} - -const char* DateTime::DayOfWeekToString(Days dayOfWeek) { - return DateTime::DaysString[static_cast(dayOfWeek)]; -} - -const char* DateTime::DayOfWeekShortToString(Days dayOfWeek) { - return DateTime::DaysStringShort[static_cast(dayOfWeek)]; -} - -const char* DateTime::DayOfWeekToStringLow(Days dayOfWeek) { - return DateTime::DaysStringLow[static_cast(dayOfWeek)]; -} - -const char* DateTime::DayOfWeekShortToStringLow(Days dayOfWeek) { - return DateTime::DaysStringShortLow[static_cast(dayOfWeek)]; + return MonthsStringLow[static_cast(month)]; } void DateTime::Register(Pinetime::System::SystemTask* systemTask) { this->systemTask = systemTask; } -char const* DateTime::DaysStringLow[] = {"--", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}; - -char const* DateTime::DaysStringShortLow[] = {"--", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}; - -char const* DateTime::DaysStringShort[] = {"--", "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"}; - -char const* DateTime::DaysString[] = {"--", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"}; - -char const* DateTime::MonthsString[] = {"--", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"}; - -char const* DateTime::MonthsStringLow[] = {"--", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; - -char const* DateTime::MonthsLow[] = { - "--", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; diff --git a/src/components/datetime/DateTimeController.h b/src/components/datetime/DateTimeController.h index c5f218d8..77ed68e8 100644 --- a/src/components/datetime/DateTimeController.h +++ b/src/components/datetime/DateTimeController.h @@ -59,20 +59,8 @@ namespace Pinetime { } const char* MonthShortToString(); - const char* MonthShortToStringLow(); - const char* MonthsToStringLow(); - const char* DayOfWeekToString(); const char* DayOfWeekShortToString(); - const char* DayOfWeekToStringLow(); - const char* DayOfWeekShortToStringLow(); - - static const char* MonthShortToString(Months month); static const char* MonthShortToStringLow(Months month); - static const char* MonthsToStringLow(Months month); - static const char* DayOfWeekToString(Days dayOfWeek); - static const char* DayOfWeekShortToString(Days dayOfWeek); - static const char* DayOfWeekToStringLow(Days dayOfWeek); - static const char* DayOfWeekShortToStringLow(Days dayOfWeek); std::chrono::time_point CurrentDateTime() const { return currentDateTime; @@ -99,14 +87,6 @@ namespace Pinetime { bool isMidnightAlreadyNotified = false; System::SystemTask* systemTask = nullptr; - - static char const* DaysString[]; - static char const* DaysStringShort[]; - static char const* DaysStringLow[]; - static char const* DaysStringShortLow[]; - static char const* MonthsString[]; - static char const* MonthsStringLow[]; - static char const* MonthsLow[]; }; } }