Author: FintasticMan <finlay.neon.kid@gmail.com>
chrono: Resolve TODOs related to C++20 chrono feats
src/displayapp/screens/WatchFaceAnalog.cpp | 2 +- src/displayapp/screens/WatchFaceAnalog.h | 3 +-- src/displayapp/screens/WatchFaceCasioStyleG7710.cpp | 2 +- src/displayapp/screens/WatchFaceCasioStyleG7710.h | 3 +-- src/displayapp/screens/WatchFaceDigital.cpp | 2 +- src/displayapp/screens/WatchFaceDigital.h | 3 +-- src/displayapp/screens/WatchFaceInfineat.cpp | 2 +- src/displayapp/screens/WatchFaceInfineat.h | 3 +-- src/displayapp/screens/WatchFaceTerminal.cpp | 2 +- src/displayapp/screens/WatchFaceTerminal.h | 3 +--
diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index 2b27ad640244fdedf6186b2cbadb9f2492dea9da..80a1c8b9b5be88ddaadd0a9ad63bc16a3c5102e9 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -256,7 +256,7 @@ currentDateTime = dateTimeController.CurrentDateTime(); if (currentDateTime.IsUpdated()) { UpdateClock(); - currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get()); + currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get()); if (currentDate.IsUpdated()) { lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day()); } diff --git a/src/displayapp/screens/WatchFaceAnalog.h b/src/displayapp/screens/WatchFaceAnalog.h index 89ad4e134603e986a5aa804e53d0402777dd2400..2eee657e9baf5234630df356d47290bcbe4a408b 100644 --- a/src/displayapp/screens/WatchFaceAnalog.h +++ b/src/displayapp/screens/WatchFaceAnalog.h @@ -43,8 +43,7 @@ Utility::DirtyValueisCharging {}; Utility::DirtyValue<bool> bleState {}; Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime; Utility::DirtyValue<bool> notificationState {false}; - using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20 - Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate; + Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate; lv_obj_t* minor_scales; lv_obj_t* major_scales; diff --git a/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp b/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp index 72bfaaa329fc96aa9c3d4ff66b51f500cc8ce27b..c695f852febd1976c7836ca895c17afa1cba5e6f 100644 --- a/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp +++ b/src/displayapp/screens/WatchFaceCasioStyleG7710.cpp @@ -244,7 +244,7 @@ lv_label_set_text_fmt(label_time, "%02d:%02d", hour, minute); } lv_obj_realign(label_time); - currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get()); + currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get()); if (currentDate.IsUpdated()) { const char* weekNumberFormat = "%V"; diff --git a/src/displayapp/screens/WatchFaceCasioStyleG7710.h b/src/displayapp/screens/WatchFaceCasioStyleG7710.h index f10e931ce4607a58398e4a0ce595e487df6de248..0f46a69251a5065c9dbf2006f060332076faff41 100644 --- a/src/displayapp/screens/WatchFaceCasioStyleG7710.h +++ b/src/displayapp/screens/WatchFaceCasioStyleG7710.h @@ -51,8 +51,7 @@ Utility::DirtyValue stepCount {}; Utility::DirtyValue<uint8_t> heartbeat {}; Utility::DirtyValue<bool> heartbeatRunning {}; Utility::DirtyValue<bool> notificationState {}; - using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20 - Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate; + Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate; lv_point_t line_icons_points[3] {{0, 5}, {117, 5}, {122, 0}}; lv_point_t line_day_of_week_number_points[4] {{0, 0}, {100, 0}, {95, 95}, {0, 95}}; diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index afe00fa5d0a1eaf2475b24cdf0a0a062170f305f..2e00ee9819b7b3106f69ce18484ed5c8aaa689e5 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -125,7 +125,7 @@ lv_label_set_text_fmt(label_time, "%02d:%02d", hour, minute); lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); } - currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get()); + currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get()); if (currentDate.IsUpdated()) { uint16_t year = dateTimeController.Year(); uint8_t day = dateTimeController.Day(); diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h index 3ff78c8aeca363e8f38205a31d44d56e4ff9ddc7..78232c1edd30ec117b6562e8902d173683cff5ee 100644 --- a/src/displayapp/screens/WatchFaceDigital.h +++ b/src/displayapp/screens/WatchFaceDigital.h @@ -54,8 +54,7 @@ Utility::DirtyValue heartbeatRunning {}; Utility::DirtyValue<bool> notificationState {}; Utility::DirtyValue<std::optional<Pinetime::Controllers::SimpleWeatherService::CurrentWeather>> currentWeather {}; - using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20 - Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate; + Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate; lv_obj_t* label_time; lv_obj_t* label_time_ampm; diff --git a/src/displayapp/screens/WatchFaceInfineat.cpp b/src/displayapp/screens/WatchFaceInfineat.cpp index c643f3bd791d633eabdb044fac543c6d61a56db6..4c6fc196ac80e5473c49d2308c0314a40a0a288b 100644 --- a/src/displayapp/screens/WatchFaceInfineat.cpp +++ b/src/displayapp/screens/WatchFaceInfineat.cpp @@ -423,7 +423,7 @@ lv_obj_align(labelHour, timeContainer, LV_ALIGN_IN_TOP_MID, 0, 5); lv_obj_align(labelMinutes, timeContainer, LV_ALIGN_IN_BOTTOM_MID, 0, 0); } - currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get()); + currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get()); if (currentDate.IsUpdated()) { uint8_t day = dateTimeController.Day(); Controllers::DateTime::Days dayOfWeek = dateTimeController.DayOfWeek(); diff --git a/src/displayapp/screens/WatchFaceInfineat.h b/src/displayapp/screens/WatchFaceInfineat.h index 32c08f1887089565bda31105c0b4477f70ad4eac..55c43f98e0bc596262a9b2662d57e7c4be5f1ed1 100644 --- a/src/displayapp/screens/WatchFaceInfineat.h +++ b/src/displayapp/screens/WatchFaceInfineat.h @@ -55,8 +55,7 @@ Utility::DirtyValue bleRadioEnabled {}; Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::minutes>> currentDateTime {}; Utility::DirtyValue<uint32_t> stepCount {}; Utility::DirtyValue<bool> notificationState {}; - using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20 - Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate; + Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate; // Lines making up the side cover lv_obj_t* lineBattery; diff --git a/src/displayapp/screens/WatchFaceTerminal.cpp b/src/displayapp/screens/WatchFaceTerminal.cpp index 723837299b626aea5cae8d6d4aedc93b2fa9845e..96d77741fd70da4f8fd32884f91cb84c1b0e9481 100644 --- a/src/displayapp/screens/WatchFaceTerminal.cpp +++ b/src/displayapp/screens/WatchFaceTerminal.cpp @@ -125,7 +125,7 @@ } else { lv_label_set_text_fmt(label_time, "[TIME]#11cc55 %02d:%02d:%02d", hour, minute, second); } - currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get()); + currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get()); if (currentDate.IsUpdated()) { uint16_t year = dateTimeController.Year(); Controllers::DateTime::Months month = dateTimeController.Month(); diff --git a/src/displayapp/screens/WatchFaceTerminal.h b/src/displayapp/screens/WatchFaceTerminal.h index ce22005fb9619df2d35d8097553fa7c6489c803f..bf4608660f5bc1b33091d71c6bc583236b37e653 100644 --- a/src/displayapp/screens/WatchFaceTerminal.h +++ b/src/displayapp/screens/WatchFaceTerminal.h @@ -45,8 +45,7 @@ Utility::DirtyValue stepCount {}; Utility::DirtyValue<uint8_t> heartbeat {}; Utility::DirtyValue<bool> heartbeatRunning {}; Utility::DirtyValue<bool> notificationState {}; - using days = std::chrono::duration<int32_t, std::ratio<86400>>; // TODO: days is standard in c++20 - Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, days>> currentDate; + Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate; lv_obj_t* label_time; lv_obj_t* label_date;