Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chrono: Resolve TODOs related to C++20 chrono feats #2016

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/displayapp/screens/WatchFaceAnalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void WatchFaceAnalog::Refresh() {
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());
}
Expand Down
3 changes: 1 addition & 2 deletions src/displayapp/screens/WatchFaceAnalog.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ namespace Pinetime {
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;
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/screens/WatchFaceCasioStyleG7710.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ void WatchFaceCasioStyleG7710::Refresh() {
}
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";

Expand Down
3 changes: 1 addition & 2 deletions src/displayapp/screens/WatchFaceCasioStyleG7710.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ namespace Pinetime {
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}};
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/screens/WatchFaceDigital.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void WatchFaceDigital::Refresh() {
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();
Expand Down
3 changes: 1 addition & 2 deletions src/displayapp/screens/WatchFaceDigital.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ namespace Pinetime {
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;
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/screens/WatchFaceInfineat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ void WatchFaceInfineat::Refresh() {
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();
lv_label_set_text_fmt(labelDate, "%s %02d", dateTimeController.DayOfWeekShortToStringLow(), day);
Expand Down
3 changes: 1 addition & 2 deletions src/displayapp/screens/WatchFaceInfineat.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ namespace Pinetime {
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;
Expand Down
2 changes: 1 addition & 1 deletion src/displayapp/screens/WatchFaceTerminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void WatchFaceTerminal::Refresh() {
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();
Expand Down
3 changes: 1 addition & 2 deletions src/displayapp/screens/WatchFaceTerminal.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ namespace Pinetime {
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;
Expand Down
Loading